Обсуждение: Comment on Database and Admin Metadata

Поиск
Список
Период
Сортировка

Comment on Database and Admin Metadata

От
"Kuhn, Dylan K (4520500D)"
Дата:

Greetings,

We are storing some metadata about a database in the database comment.  In short my question is, is there a better place?

We use a version-controlled model for our database design, and would like to know what model version any particular database implements.  A client can thereby determine by the model version if it is able to use the database. 

Bug #880 (http://archives.postgresql.org/pgsql-bugs/2003-01/msg00131.php) discusses some of the problems with comments on databases.  You have to know the current database name to create the comment, but you can't use current_database(), and you can't create a comment on any other database.  Also, you have to connect to the database to read the comment (which is not horrible, but not obvious either when looking at commands like '\l+').

This seems like it would be a common problem.  I'd like to know if there is a better place for such database-level metadata, and if there are plans to fix/change COMMENT ON DATABASE.  Or even if anyone else is deleting and adding records to pg_description like we are to accomplish this.

Thanks,
Dylan Kuhn

Re: Comment on Database and Admin Metadata

От
"David F. Skoll"
Дата:
On Wed, 14 May 2003, Kuhn, Dylan K (4520500D) wrote:

> We use a version-controlled model for our database design, and would
> like to know what model version any particular database implements.  A
> client can thereby determine by the model version if it is able to use
> the database.

I use a special table called "schema" that holds a one-row entry with
the schema version number.  The upgrade scripts can extract the
existing schema and do any necessary adjustments to bring the schema
up-to-date.

It's not sophisticated, but it works.

--
David.

Re: Comment on Database and Admin Metadata

От
Tom Lane
Дата:
"Kuhn, Dylan K (4520500D)" <Dylan.Kuhn@navy.mil> writes:
> We are storing some metadata about a database in the database comment.  In =
> short my question is, is there a better place?

I'd suggest making a "control table" in each database that stores
whatever you need.  The database comment is only one field, but a
control table could be extended limitlessly.

> Bug #880 (http://archives.postgresql.org/pgsql-bugs/2003-01/msg00131.php) d=
> iscusses some of the problems with comments on databases.

AFAIK, no one has any plans to change the handling of comments.
Certainly it's not a very high-priority item.

            regards, tom lane