diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-04-24 02:50:30 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-04-24 02:50:30 +0000 |
commit | ab117a6643b6e2e3dbceb89324765eeed543d2c7 (patch) | |
tree | 816febf591df12a5af8c317817211fc9e1880971 | |
parent | a02f83426b44be4e3eb22252a1406c201479ee74 (diff) | |
download | postgresql-ab117a6643b6e2e3dbceb89324765eeed543d2c7.tar.gz postgresql-ab117a6643b6e2e3dbceb89324765eeed543d2c7.zip |
Restrict comment to the current database in order to prevent them from
mysteriously disappearing.
ie. \d+ will only ever show the comment for the current database --
which is appropriate since it can only pull comments from the current
database.
Won't break pgadmin functionality as it enforces this behaviour already.
I didn't find any regression tests for COMMENT.
Rod Taylor
-rw-r--r-- | src/backend/commands/comment.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c index 63c023cf0e2..3968ef14ef9 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -7,7 +7,7 @@ * Copyright (c) 1999-2001, PostgreSQL Global Development Group * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.43 2002/04/19 16:36:08 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.44 2002/04/24 02:50:30 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -438,6 +438,10 @@ CommentDatabase(List *qualname, char *comment) elog(ERROR, "CommentDatabase: database name may not be qualified"); database = strVal(lfirst(qualname)); + /* Only allow comments on the current database */ + if (strcmp(database, DatabaseName) != 0) + elog(ERROR, "Database comments may only be applied to the current database"); + /* First find the tuple in pg_database for the database */ pg_database = heap_openr(DatabaseRelationName, AccessShareLock); |