Table like a field

From: lucas(at)presserv(dot)org
To: pgsql-sql(at)postgresql(dot)org
Subject: Table like a field
Date: 2005-03-09 13:46:16
Message-ID: 20050309104616.8cjneru7plccgss4@www.presserv.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello.
Is there any way to build a table that contain the coluns name for the other
table fields? like this:

create table people(id serial primary key, name varchar(50) );
create table people_fields ( field_name varchar(30) );
insert into people_fields values ('occupation');
insert into people_fields values ('address');

then I create any function or view to get:
SELECT * FROM people; //may return

id - name - | ocuppation - address |

Then if I insert a new record in the people_fields table, the new record will
appear as a new field in the people table.
Of course, its not a new field, but when i select by my function/view i can see
anything like it.

How can I create this function to aggregate the both tables??

Thank you.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2005-03-09 13:48:38 Re: order by question
Previous Message Richard Huxton 2005-03-09 13:06:26 Re: order by question