Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Nested tables

From: Jason Vasquez <VASQUEZ_JASON(at)Lilly(dot)com>
To: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Nested tables
Date: 2000-03-04 17:28:30
Message-ID: 05256898.006001B8.00@aammta1.d51.lilly.com (view raw or flat)
Thread:
Lists: pgsql-general

Thanks to all for the great responses.  Foreign keys do seem to be the way to
go.  That would be my luck to pick a data type for a table name...this type
seems a bit obscure--I wasn't able to find any documentation on it. Does
anyone know what it is for?

Thanks,
-Jason





Ed Loehr <eloehr(at)austin(dot)rr(dot)com> on 03/03/2000 06:32:19 PM


To:   Jason Vasquez/AM/LLY(at)Lilly, pgsql-general(at)postgreSQL(dot)org
cc:
bcc:


Subject:  Re: [GENERAL] Nested tables



Ed Loehr wrote:
>
> Jason Vasquez wrote:
> > Basically, I'd like to set up an ACL-like property for each record. A
table
> > could be strucured like this:
> >
> > Table ACL:
> >    Attribute   |    Type     |          Modifier
> > ---------------+-------------+----------------------------
> >  uniqid        | varchar(12) | not null
> >  date_created  | timestamp   | not null
> >  date_modified | timestamp   | not null
> >  read          | boolean     | not null default 'f'::bool
> >  write         | boolean     | not null default 'f'::bool
> >  execute       | boolean     | not null default 'f'::bool
> >  delete        | boolean     | not null default 'f'::bool
> >
> > Table myItem:
> >    Attribute    |    Type     | Modifier
> > ----------------+-------------+----------
> >  uniqid         | varchar(12) | not null
> >  date_created   | timestamp   | not null
> >  date_modified  | timestamp   | not null
> >  author         | text        | not null
> >  title          | text        | not null
> >  access_control | acl         | not null
> >
> > PostgreSQL lets me create the class myItem with a "acl" field type, but I
> > can't figure out how to insert multiple values (or any values!) into the
> > access_control field...
>
> Hmmm.  Why would you want that?  Do you really mean to insert multiple
> records, each with an individual access_control value?  At the risk of
> completely oversimplifying your problem, my guess is that you're
> looking for the notion of a foreign key in myItem, i.e.,
>
> Table ACL:
>    uniqid   integer not null unique,  -- or use pgsql 'serial' type...
>    ...
>
> Table myItem:
>    uniqid      integer not null unique,
>    ...
>    ACL_uniqid  integer not null  -- a foreign key into ACL

Well, I snooped around a bit and apparently there is a built-in type
called 'acl'.  So either I spoke up when I had no idea what I was
talking about (and no idea that I had no idea) but you did, or you got
unlucky and named a table by the same name as a pgsql built-in type.
Chances are it's the former.

Cheers,
Ed Loehr

************






pgsql-general by date

Next:From: Ed LoehrDate: 2000-03-04 21:40:14
Subject: Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions
Previous:From: Peter EisentrautDate: 2000-03-04 17:05:49
Subject: Re: [GENERAL] Nested tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group