By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

Adding header nam to any table

P: n/a
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?

Thanks!!
cu

--
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #2

P: n/a
On Tue, 2003-09-09 at 10: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


In psql, you can do:
SELECT id as "User ID", name as "Username", age as "Age of user"
FROM foobar;

A special table where you manually map field names to descriptive
would also work, and be generic.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ro***********@cox.net
Jefferson, LA USA

"Fair is where you take your cows to be judged."
Unknown
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.