Re: Adding header nam to any table

From: Richard Huxton <dev(at)archonet(dot)com>
To: Michael Vodep <mvodep(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Adding header nam to any table
Date: 2003-09-10 08:29:07
Message-ID: 200309100929.07861.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 09 September 2003 16:49, Michael Vodep wrote:
> Hi!
> I am using postgresql with PHP and C. Is it possible to add header
> information to every table? For example:
> id | name | age
> should be
> User ID | Username | Age of user
> This should be displayed, when i query the header information. Is this
> possible? Maybe i can add a comment to every column header? Or is there a
> simple way for storeing this additional information in a other table and
> solve this problem by writting some special SQL statements?

Well, one solution which I tend to use is to keep this information in my
application layer (PHP/C in your case).

Since PHP will need to know something about the structure of the database
anyway, I keep all this together. Something like:

$Tables['user_age'] = array(
'id' => array('type' => 'int', 'desc'=>'User ID'),
'name' => array( 'type'=>'text', 'desc'=>'User name' ),
'age' => array('type'=>'int', 'desc'=>'Age of user' )
);

In fact, where possible I like to generate the above table and my SQL from the
same definitions-file.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2003-09-10 08:44:42 Re: Adding header nam to any table
Previous Message Richard Huxton 2003-09-10 08:23:46 Re: SUMMARY mysql -> psql