pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTable like a field
2+ messages / 2 participants
[nested] [flat]
* Table like a field
@ 2005-03-09 13:46 lucas@presserv.org
2005-03-09 14:19 ` Re: Table like a field Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 2+ messages in thread
From: lucas@presserv.org @ 2005-03-09 13:46 UTC (permalink / raw)
To: 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Table like a field
2005-03-09 13:46 Table like a field lucas@presserv.org
@ 2005-03-09 14:19 ` Richard Huxton <dev@archonet.com>
0 siblings, 0 replies; 2+ messages in thread
From: Richard Huxton @ 2005-03-09 14:19 UTC (permalink / raw)
To: lucas@presserv.org; +Cc: pgsql-sql
lucas@presserv.org wrote:
> 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 |
You'll want to search the mailing-list archives for "crosstab", and also
look in the contrib/ section of the source distribution.
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-03-09 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-09 13:46 Table like a field lucas@presserv.org
2005-03-09 14:19 ` Richard Huxton <dev@archonet.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox