createdb comments
Head of development branch (7.3devel) has a problem applying a comment to a
database at the sametime as the database is created using the createdb
utility.
The error message states the problem:
pgsql-current-test$ createdb testdb Test
CREATE DATABASE
ERROR: Database comments may only be applied to the current database
createdb: comment creation failed (database was created)
The database is created but the comment does indeed fail for the reason given,
as illustrated by:
template1=# \c template1
You are now connected to database template1.
template1=# comment on database testdb is 'Test';
ERROR: Database comments may only be applied to the current database
template1=# \c testdb
You are now connected to database testdb.
testdb=# comment on database testdb is 'Test';
COMMENT
Sorry if this isn't news.
--
Nigel J. Andrews
Director
---
Logictree Systems Limited
Computer Consultants
The following patch fixes the problem. Applied.
---------------------------------------------------------------------------
Nigel J. Andrews wrote:
Head of development branch (7.3devel) has a problem applying a comment to a
database at the sametime as the database is created using the createdb
utility.The error message states the problem:
pgsql-current-test$ createdb testdb Test
CREATE DATABASE
ERROR: Database comments may only be applied to the current database
createdb: comment creation failed (database was created)The database is created but the comment does indeed fail for the reason given,
as illustrated by:template1=# \c template1
You are now connected to database template1.
template1=# comment on database testdb is 'Test';
ERROR: Database comments may only be applied to the current database
template1=# \c testdb
You are now connected to database testdb.
testdb=# comment on database testdb is 'Test';
COMMENTSorry if this isn't news.
--
Nigel J. Andrews
Director---
Logictree Systems Limited
Computer Consultants---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Attachments:
/bjm/difftext/plainDownload+2-2
[I've changed the list to -general from -bugs. I hope that's acceptable]
Thanks Bruce,
If I'd realised createdb was that simple I'd have done it myself. However, I
think I was locked into the idea that the SQL command should work as well.
I'm afraid I don't know the standard but from the command I would assume that
the COMMENT ON DATABASE was intended to work on any database from any
database. Is that incorrect, possibly because of security concerns?
On Tue, 11 Jun 2002, Bruce Momjian wrote:
The following patch [somehow lost by pine in my reply] fixes the
problem. Applied.---------------------------------------------------------------------------
Nigel J. Andrews wrote:
Head of development branch (7.3devel) has a problem applying a comment to a
database at the sametime as the database is created using the createdb
utility.The error message states the problem:
pgsql-current-test$ createdb testdb Test
CREATE DATABASE
ERROR: Database comments may only be applied to the current database
createdb: comment creation failed (database was created)The database is created but the comment does indeed fail for the reason given,
as illustrated by:template1=# \c template1
You are now connected to database template1.
template1=# comment on database testdb is 'Test';
ERROR: Database comments may only be applied to the current database
template1=# \c testdb
You are now connected to database testdb.
testdb=# comment on database testdb is 'Test';
COMMENTSorry if this isn't news.
--
Nigel J. Andrews
--
Nigel J. Andrews
Director
---
Logictree Systems Limited
Computer Consultants
Nigel J. Andrews wrote:
[I've changed the list to -general from -bugs. I hope that's acceptable]
Thanks Bruce,
If I'd realised createdb was that simple I'd have done it myself. However, I
think I was locked into the idea that the SQL command should work as well.I'm afraid I don't know the standard but from the command I would assume that
the COMMENT ON DATABASE was intended to work on any database from any
database. Is that incorrect, possibly because of security concerns?
No, it can't because pg_description is per-database, while pg_database
is global to all databases. No way to handle this because we can't
update every pg_description in every database. We could update just
template1's pg_description, but only the super-user can do that. What
we do is to just update the datbase description stored in the current
database.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026