Re: [GENERAL] Nested tables

From: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
To: Jason Vasquez <VASQUEZ_JASON(at)Lilly(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Nested tables
Date: 2000-03-03 23:18:37
Message-ID: 38C0484D.B53C6950@austin.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jason Vasquez wrote:
>
> I've looked through the documentation, but I've not found anything that
> addresses this situation. Is this possible with PostgreSQL? Or maybe there is
> a better way to accomplish what I want to do?
>
> 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

Cheers,
Ed Loehr

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ed Loehr 2000-03-03 23:32:19 Re: [GENERAL] Nested tables
Previous Message omid omoomi 2000-03-03 23:04:52 Re: [GENERAL] Nested tables