Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2eebcdd

Browse files
committed
Bruce,
Attached is a patch which patches cleanly against the Sunday afternoon snapshot. It modifies pg_dump to dump COMMENT ON statements for user-definable descriptions. In addition, it also modifies comment.c so that the operator behavior is as Peter E. would like: a comment on an operator is applied to the underlying function. Thanks, Mike Mascari
1 parent 6c25ea2 commit 2eebcdd

File tree

4 files changed

+229
-9
lines changed

4 files changed

+229
-9
lines changed

src/backend/commands/comment.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "catalog/pg_aggregate.h"
2020
#include "catalog/pg_database.h"
2121
#include "catalog/pg_description.h"
22+
#include "catalog/pg_operator.h"
2223
#include "catalog/pg_proc.h"
2324
#include "catalog/pg_rewrite.h"
2425
#include "catalog/pg_shadow.h"
@@ -658,6 +659,7 @@ void CommentProc(char *function, List *arguments, char *comment)
658659

659660
void CommentOperator(char *opername, List *arguments, char *comment) {
660661

662+
Form_pg_operator data;
661663
HeapTuple optuple;
662664
Oid oid, leftoid = InvalidOid, rightoid = InvalidOid;
663665
bool defined;
@@ -719,6 +721,14 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
719721
}
720722
#endif
721723

724+
/*** Get the procedure associated with the operator ***/
725+
726+
data = (Form_pg_operator) GETSTRUCT(optuple);
727+
oid = regproctooid(data->oprcode);
728+
if (oid == InvalidOid) {
729+
elog(ERROR, "operator '%s' does not have an underlying function", opername);
730+
}
731+
722732
/*** Call CreateComments() to create/drop the comments ***/
723733

724734
CreateComments(oid, comment);

src/bin/pg_dump/common.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.38 2000/01/18 07:29:58 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.39 2000/01/18 18:09:02 momjian Exp $
1111
*
1212
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1313
*
@@ -289,6 +289,14 @@ dumpSchema(FILE *fout,
289289
g_comment_start, g_comment_end);
290290
flagInhAttrs(tblinfo, numTables, inhinfo, numInherits);
291291

292+
if (!tablename && fout)
293+
{
294+
if (g_verbose)
295+
fprintf(stderr, "%s dumping out database comment %s\n",
296+
g_comment_start, g_comment_end);
297+
dumpDBComment(fout);
298+
}
299+
292300
if (!tablename && fout)
293301
{
294302
if (g_verbose)

0 commit comments

Comments
 (0)