Commit 2eebcdde authored by Bruce Momjian's avatar Bruce Momjian

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
parent 6c25ea23
......@@ -19,6 +19,7 @@
#include "catalog/pg_aggregate.h"
#include "catalog/pg_database.h"
#include "catalog/pg_description.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_shadow.h"
......@@ -658,6 +659,7 @@ void CommentProc(char *function, List *arguments, char *comment)
void CommentOperator(char *opername, List *arguments, char *comment) {
Form_pg_operator data;
HeapTuple optuple;
Oid oid, leftoid = InvalidOid, rightoid = InvalidOid;
bool defined;
......@@ -719,6 +721,14 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
}
#endif
/*** Get the procedure associated with the operator ***/
data = (Form_pg_operator) GETSTRUCT(optuple);
oid = regproctooid(data->oprcode);
if (oid == InvalidOid) {
elog(ERROR, "operator '%s' does not have an underlying function", opername);
}
/*** Call CreateComments() to create/drop the comments ***/
CreateComments(oid, comment);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.38 2000/01/18 07:29:58 tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.39 2000/01/18 18:09:02 momjian Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
......@@ -289,6 +289,14 @@ dumpSchema(FILE *fout,
g_comment_start, g_comment_end);
flagInhAttrs(tblinfo, numTables, inhinfo, numInherits);
if (!tablename && fout)
{
if (g_verbose)
fprintf(stderr, "%s dumping out database comment %s\n",
g_comment_start, g_comment_end);
dumpDBComment(fout);
}
if (!tablename && fout)
{
if (g_verbose)
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_dump.h,v 1.45 2000/01/16 03:54:58 tgl Exp $
* $Id: pg_dump.h,v 1.46 2000/01/18 18:09:02 momjian Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
......@@ -74,6 +74,7 @@ typedef struct _tableInfo
* attribute if the value is 1, then this
* attribute is an inherited attribute */
char **attnames; /* the attribute names */
char **attoids; /* oids of the various attributes */
char **typnames; /* fill out attributes */
bool *notnull; /* Not null constraints of an attribute */
char **adef_expr; /* DEFAULT expressions */
......@@ -93,6 +94,8 @@ typedef struct _tableInfo
char **check_expr; /* [CONSTRAINT name] CHECK expressions */
int ntrig; /* # of triggers */
char **triggers; /* CREATE TRIGGER ... */
char **trcomments; /* COMMENT ON TRIGGER ... */
char **troids; /* TRIGGER oids */
char *primary_key; /* PRIMARY KEY of the table, if any */
} TableInfo;
......@@ -104,6 +107,7 @@ typedef struct _inhInfo
typedef struct _indInfo
{
char *indoid; /* oid of the pg_class entry for the index */
char *indexrelname; /* name of the secondary index class */
char *indrelname; /* name of the indexed heap class */
char *indamname; /* name of the access method (e.g. btree,
......@@ -210,6 +214,7 @@ extern TableInfo *getTables(int *numTables, FuncInfo *finfo, int numFuncs);
extern InhInfo *getInherits(int *numInherits);
extern void getTableAttrs(TableInfo *tbinfo, int numTables);
extern IndInfo *getIndices(int *numIndices);
extern void dumpDBComment(FILE *outfile);
extern void dumpTypes(FILE *fout, FuncInfo *finfo, int numFuncs,
TypeInfo *tinfo, int numTypes);
extern void dumpProcLangs(FILE *fout, FuncInfo *finfo, int numFuncs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment