- * is 'text'
+ * 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 | INDEX | RULE | SEQUENCE | TABLE | TYPE | VIEW ]
+ *
| AGGREGATE | FUNCTION
+ * (arg1, arg2, ...) | OPERATOR
+ * (leftoperand_typ rightoperand_typ) | TRIGGER ON
+ * ] IS 'text'
*
*****************************************************************************/
-CommentStmt: COMMENT ON COLUMN relation_name '.' attr_name IS Sconst
+CommentStmt: COMMENT ON comment_type name IS comment_text
{
- cat2_str(cat5_str(make1_str("comment on column"), $4, make1_str(","), $6, make1_str("is")), $8);
+ $$ = cat5_str(make1_str("comment on"), $3, $4, make1_str("is"), $6);
}
- | COMMENT ON TABLE relation_name IS Sconst
+ | COMMENT ON comment_cl relation_name '.' attr_name IS comment_text
+ {
+ $$ = cat3_str(cat5_str(make1_str("comment on"), $3, $4, make1_str("."), $6), make1_str("is"), $8);
+ }
+ | COMMENT ON comment_ag name aggr_argtype IS comment_text
+ {
+ cat2_str(cat5_str(make1_str("comment on"), $3, $4, $5, make1_str("is")), $7);
+ }
+ | COMMENT ON comment_fn func_name func_args IS comment_text
+ {
+ cat2_str(cat5_str(make1_str("comment on"), $3, $4, $5, make1_str("is")), $7);
+ }
+ | COMMENT ON comment_op all_Op '(' oper_argtypes ')' IS comment_text
+ {
+ cat3_str(cat5_str(make1_str("comment on"), $3, $4, make1_str("("), $6), make1_str(") is"), $9);
+ }
+ | COMMENT ON comment_tg name ON relation_name IS comment_text
{
- cat4_str(make1_str("comment on table"), $4, make1_str("is"), $6);
+ cat3_str(cat5_str(make1_str("comment on"), $3, $4, make1_str("on"), $6), make1_str("is"), $8);
}
;
-
+
+comment_type: DATABASE { $$ = make1_str("database"); }
+ | INDEX { $$ = make1_str("idnex"); }
+ | RULE { $$ = make1_str("rule"); }
+ | SEQUENCE { $$ = make1_str("sequence"); }
+ | TABLE { $$ = make1_str("table"); }
+ | TYPE_P { $$ = make1_str("type"); }
+ | VIEW { $$ = make1_str("view"); }
+ ;
+
+comment_cl: COLUMN { $$ = make1_str("column"); }
+
+comment_ag: AGGREGATE { $$ = make1_str("aggregate"); }
+
+comment_fn: FUNCTION { $$ = make1_str("function"); }
+
+comment_op: OPERATOR { $$ = make1_str("operator"); }
+
+comment_tg: TRIGGER { $$ = make1_str("trigger"); }
+
+comment_text: Sconst { $$ = $1; }
+ | NULL_P { $$ = make1_str("null"); }
+ ;
+
/*****************************************************************************
*
* QUERY: