diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-02-28 22:37:27 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-02-28 22:37:27 +0000 |
commit | 8e68d783902b0b47f377efa4a23a04ddeef272a8 (patch) | |
tree | dfb6af0332b662faad90a752d63224fe1ba60470 /src/backend/parser | |
parent | 7f19339cca746753d898651d128ad038b6e1c635 (diff) | |
download | postgresql-8e68d783902b0b47f377efa4a23a04ddeef272a8.tar.gz postgresql-8e68d783902b0b47f377efa4a23a04ddeef272a8.zip |
Allow the syntax CREATE TYPE foo, with no parameters, to permit explicit
creation of a shell type. This allows a less hacky way of dealing with
the mutual dependency between a datatype and its I/O functions: make a
shell type, then make the functions, then define the datatype fully.
We should fix pg_dump to handle things this way, but this commit just deals
with the backend.
Martijn van Oosterhout, with some corrections by Tom Lane.
Diffstat (limited to 'src/backend/parser')
-rw-r--r-- | src/backend/parser/gram.y | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 6cb6f96fa4f..a60d4157b2e 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.530 2006/02/19 00:04:27 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.531 2006/02/28 22:37:26 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -2690,6 +2690,15 @@ DefineStmt: n->definition = $4; $$ = (Node *)n; } + | CREATE TYPE_P any_name + { + /* Shell type (identified by lack of definition) */ + DefineStmt *n = makeNode(DefineStmt); + n->kind = OBJECT_TYPE; + n->defnames = $3; + n->definition = NIL; + $$ = (Node *)n; + } | CREATE TYPE_P any_name AS '(' TableFuncElementList ')' { CompositeTypeStmt *n = makeNode(CompositeTypeStmt); |