diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2010-10-25 21:40:46 +0300 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2010-10-25 21:44:49 +0300 |
commit | 35670340f57d78d6ab023b1fb42fd81339f85d4c (patch) | |
tree | 353a103641ea21787ace05801ebc9f2a42e61137 /src/backend/commands/tablecmds.c | |
parent | c6873eac4c33720140240cdbd1a663fecc922c57 (diff) | |
download | postgresql-35670340f57d78d6ab023b1fb42fd81339f85d4c.tar.gz postgresql-35670340f57d78d6ab023b1fb42fd81339f85d4c.zip |
Refactor typenameTypeId()
Split the old typenameTypeId() into two functions: A new typenameTypeId() that
returns only a type OID, and typenameTypeIdAndMod() that returns type OID and
typmod. This isolates call sites better that actually care about the typmod.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index c0097117545..6ec8a854100 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -464,7 +464,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) (void) heap_reloptions(relkind, reloptions, true); if (stmt->ofTypename) - ofTypeId = typenameTypeId(NULL, stmt->ofTypename, NULL); + ofTypeId = typenameTypeId(NULL, stmt->ofTypename); else ofTypeId = InvalidOid; @@ -1399,7 +1399,7 @@ MergeAttributes(List *schema, List *supers, bool istemp, (errmsg("merging multiple inherited definitions of column \"%s\"", attributeName))); def = (ColumnDef *) list_nth(inhSchema, exist_attno - 1); - defTypeId = typenameTypeId(NULL, def->typeName, &deftypmod); + typenameTypeIdAndMod(NULL, def->typeName, &defTypeId, &deftypmod); if (defTypeId != attribute->atttypid || deftypmod != attribute->atttypmod) ereport(ERROR, @@ -1571,8 +1571,8 @@ MergeAttributes(List *schema, List *supers, bool istemp, (errmsg("merging column \"%s\" with inherited definition", attributeName))); def = (ColumnDef *) list_nth(inhSchema, exist_attno - 1); - defTypeId = typenameTypeId(NULL, def->typeName, &deftypmod); - newTypeId = typenameTypeId(NULL, newdef->typeName, &newtypmod); + typenameTypeIdAndMod(NULL, def->typeName, &defTypeId, &deftypmod); + typenameTypeIdAndMod(NULL, newdef->typeName, &newTypeId, &newtypmod); if (defTypeId != newTypeId || deftypmod != newtypmod) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), @@ -3910,7 +3910,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, int32 ctypmod; /* Child column must match by type */ - ctypeId = typenameTypeId(NULL, colDef->typeName, &ctypmod); + typenameTypeIdAndMod(NULL, colDef->typeName, &ctypeId, &ctypmod); if (ctypeId != childatt->atttypid || ctypmod != childatt->atttypmod) ereport(ERROR, @@ -6100,7 +6100,7 @@ ATPrepAlterColumnType(List **wqueue, colName))); /* Look up the target type */ - targettype = typenameTypeId(NULL, typeName, &targettypmod); + typenameTypeIdAndMod(NULL, typeName, &targettype, &targettypmod); /* make sure datatype is legal for a column */ CheckAttributeType(colName, targettype, false); |