summaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-11-21 22:32:49 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-11-21 22:32:49 +0000
commit42ce74bf17478cc8a8323601deaa63950dda9923 (patch)
tree917bf7d6c05971885302cd43b8c60c16c7e12bab /src/backend/parser
parent0a97cb37fc29dac05fd5aa13df91ba8431faea23 (diff)
COMMENT ON casts, conversions, languages, operator classes, and
large objects. Dump all these in pg_dump; also add code to pg_dump user-defined conversions. Make psql's large object code rely on the backend for inserting/deleting LOB comments, instead of trying to hack pg_description directly. Documentation and regression tests added. Christopher Kings-Lynne, code reviewed by Tom
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y59
-rw-r--r--src/backend/parser/keywords.c4
2 files changed, 54 insertions, 9 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 5f0b0f4e5da..337eef4480c 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.437 2003/11/06 22:08:14 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.438 2003/11/21 22:32:49 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -363,7 +363,7 @@ static void doNegateFloat(Value *v);
KEY
- LANCOMPILER LANGUAGE LAST_P LEADING LEFT LEVEL LIKE LIMIT
+ LANCOMPILER LANGUAGE LARGE_P LAST_P LEADING LEFT LEVEL LIKE LIMIT
LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION
LOCK_P
@@ -373,7 +373,7 @@ static void doNegateFloat(Value *v);
NOCREATEUSER NONE NOT NOTHING NOTIFY NOTNULL NULL_P
NULLIF NUMERIC
- OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR
+ OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR
ORDER OUT_P OUTER_P OVERLAPS OVERLAY OWNER
PARTIAL PASSWORD PATH_P PENDANT PLACING POSITION
@@ -2519,11 +2519,15 @@ TruncateStmt:
* The COMMENT ON statement can take different forms based upon the type of
* the object associated with the comment. The form of the statement is:
*
- * COMMENT ON [ [ DATABASE | DOMAIN | INDEX | SEQUENCE | TABLE | TYPE | VIEW ]
- * <objname> | AGGREGATE <aggname> (<aggtype>) | FUNCTION
- * <funcname> (arg1, arg2, ...) | OPERATOR <op>
- * (leftoperand_typ rightoperand_typ) | TRIGGER <triggername> ON
- * <relname> | RULE <rulename> ON <relname> ] IS 'text'
+ * COMMENT ON [ [ DATABASE | DOMAIN | INDEX | SEQUENCE | TABLE | TYPE | VIEW |
+ * CONVERSION | LANGUAGE | OPERATOR CLASS | LARGE OBJECT |
+ * CAST ] <objname> |
+ * AGGREGATE <aggname> (<aggtype>) |
+ * FUNCTION <funcname> (arg1, arg2, ...) |
+ * OPERATOR <op> (leftoperand_typ, rightoperand_typ) |
+ * TRIGGER <triggername> ON <relname> |
+ * RULE <rulename> ON <relname> ]
+ * IS 'text'
*
*****************************************************************************/
@@ -2603,6 +2607,42 @@ CommentStmt:
n->comment = $8;
$$ = (Node *) n;
}
+ | COMMENT ON OPERATOR CLASS any_name USING access_method IS comment_text
+ {
+ CommentStmt *n = makeNode(CommentStmt);
+ n->objtype = OBJECT_OPCLASS;
+ n->objname = $5;
+ n->objargs = makeList1(makeString($7));
+ n->comment = $9;
+ $$ = (Node *) n;
+ }
+ | COMMENT ON LARGE_P OBJECT_P NumericOnly IS comment_text
+ {
+ CommentStmt *n = makeNode(CommentStmt);
+ n->objtype = OBJECT_LARGEOBJECT;
+ n->objname = makeList1($5);
+ n->objargs = NIL;
+ n->comment = $7;
+ $$ = (Node *) n;
+ }
+ | COMMENT ON CAST '(' Typename AS Typename ')' IS comment_text
+ {
+ CommentStmt *n = makeNode(CommentStmt);
+ n->objtype = OBJECT_CAST;
+ n->objname = makeList1($5);
+ n->objargs = makeList1($7);
+ n->comment = $10;
+ $$ = (Node *) n;
+ }
+ | COMMENT ON opt_procedural LANGUAGE any_name IS comment_text
+ {
+ CommentStmt *n = makeNode(CommentStmt);
+ n->objtype = OBJECT_LANGUAGE;
+ n->objname = $5;
+ n->objargs = NIL;
+ n->comment = $7;
+ $$ = (Node *) n;
+ }
;
comment_type:
@@ -2615,6 +2655,7 @@ comment_type:
| DOMAIN_P { $$ = OBJECT_TYPE; }
| TYPE_P { $$ = OBJECT_TYPE; }
| VIEW { $$ = OBJECT_VIEW; }
+ | CONVERSION_P { $$ = OBJECT_CONVERSION; }
;
comment_text:
@@ -7365,6 +7406,7 @@ unreserved_keyword:
| KEY
| LANCOMPILER
| LANGUAGE
+ | LARGE_P
| LAST_P
| LEVEL
| LISTEN
@@ -7387,6 +7429,7 @@ unreserved_keyword:
| NOCREATEUSER
| NOTHING
| NOTIFY
+ | OBJECT_P
| OF
| OIDS
| OPERATOR
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index 6d42a13ef87..c4e50580780 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.142 2003/11/06 22:08:15 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.143 2003/11/21 22:32:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,6 +177,7 @@ static const ScanKeyword ScanKeywords[] = {
{"key", KEY},
{"lancompiler", LANCOMPILER},
{"language", LANGUAGE},
+ {"large", LARGE_P},
{"last", LAST_P},
{"leading", LEADING},
{"left", LEFT},
@@ -214,6 +215,7 @@ static const ScanKeyword ScanKeywords[] = {
{"null", NULL_P},
{"nullif", NULLIF},
{"numeric", NUMERIC},
+ {"object", OBJECT_P},
{"of", OF},
{"off", OFF},
{"offset", OFFSET},