1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

pg_type has a typnamespace column; system now supports creating types

in different namespaces.  Also, cleanup work on relation namespace
support: drop, alter, rename commands work for tables in non-default
namespaces.
This commit is contained in:
Tom Lane
2002-03-29 19:06:29 +00:00
parent 7c1ff35410
commit d5e99ab4d6
68 changed files with 2074 additions and 2266 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.111 2002/03/21 16:01:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.112 2002/03/29 19:06:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1103,7 +1103,7 @@ parser_typecast_constant(Value *expr, TypeName *typename)
bool string_palloced = false;
bool isNull = false;
tp = typenameType(TypeNameToInternalName(typename));
tp = typenameType(typename);
switch (nodeTag(expr))
{
@ -1161,7 +1161,7 @@ parser_typecast_expression(ParseState *pstate,
Oid inputType = exprType(expr);
Oid targetType;
targetType = typenameTypeId(TypeNameToInternalName(typename));
targetType = typenameTypeId(typename);
if (inputType == InvalidOid)
return expr; /* do nothing if NULL input */
@ -1185,27 +1185,3 @@ parser_typecast_expression(ParseState *pstate,
return expr;
}
/*
* Given a TypeName node as returned by the grammar, generate the internal
* name of the corresponding type. Note this does NOT check if the type
* exists or not.
*/
char *
TypeNameToInternalName(TypeName *typename)
{
Assert(typename->attrname == NULL);
if (typename->arrayBounds != NIL)
{
/*
* By convention, the name of an array type is the name of its
* element type with "_" prepended.
*/
char *arrayname = palloc(strlen(typename->name) + 2);
sprintf(arrayname, "_%s", typename->name);
return arrayname;
}
else
return typename->name;
}