On Mon, Mar 28, 2005 at 16:13:59 -0600,
  Dale Sykora <[EMAIL PROTECTED]> wrote:
> 
> CREATE TABLE user_data(
>       name varchar(32),
>       write_access bool DEFAULT 'f'
> );
> CREATE TABLE actions(
>       action varchar(32),
>       user varchar(32)  -- somehow make sure user = user_data.name where 
> user_data.write_access = 't'
> );

One way to do this is to add a write_access column to actions and use
a constraint to force it to be true. Create a UNIQUE key of
(name, write_access) for user_data and then add a FOREIGN KEY
reference from (name, write_access) in actions to (name, write_access)
in user_data.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to