X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5E6DED1C4B8 for ; Wed, 13 Aug 2003 12:55:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 11411-10 for ; Wed, 13 Aug 2003 09:53:37 -0300 (ADT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id 7E591D1B52C for ; Wed, 13 Aug 2003 09:54:57 -0300 (ADT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Wed Aug 13 14:55:00 2003 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id OAA25337; Wed, 13 Aug 2003 14:55:00 +0200 (METDST) Message-ID: <3F3A3523.4261096@rodos.fzk.de> Date: Wed, 13 Aug 2003 14:54:59 +0200 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org, luiz@klais.com.br Subject: Re: Insert a description while creating a table Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 9C hex) in message header 'Received' Received: \234by rodos.fzk.de... ^ X-Archive-Number: 200308/130 X-Sequence-Number: 14746 > > I want to insert descriptions at the columns of my tables but without > > using the command COMMENT ON. I want to do it together with the table > > creation. Is that possible? > > > > I wanna do something like this: > > > > create table test ( > > id serial 'Descripitions about ID', > > name varchar(50) 'Descriptions about NAME' > > ); > > Probably not going to happen in the backend. > > However, you should be able to accomplish that with a little bit of Perl > to pre-process the SQL. > That perl script comes to my mind too. The reason why Luiz doesn't like it, may be because you can't see these descriptions within psql using \dd test I did the create table, then COMMENT ON COLUMN test.id is 'Descripitions about ID'; COMMENT ON COLUMN test.name is 'Descriptions about NAME'; \dd test shows Object descriptions Schema | Name | Object | Description --------+------+--------+------------- (0 rows) This is odd. OK, I know the doc says \dd [ pattern ] Shows the descriptions of objects matching the pattern, or of all visible objects if no argument is given. But in either case, only objects that have a description are listed. ("Object" covers aggregates, functions, operators, types, relations (tables, views, indexes, sequences, large objects), rules, and triggers.) For example: Nothing about columns. But what is the purpose of comments on columns if you can only get them via select * from pg_description where objoid = (select typrelid from pg_type where typname='test') order by objsubid ; objoid | classoid | objsubid | description --------+----------+----------+------------------------- 17326 | 1259 | 1 | Descripitions about ID 17326 | 1259 | 2 | Descriptions about NAME (2 rows) which you'll have to find out on your own. Regards, Christoph