Re: how do you set foriegn keys in pgaccess? - Mailing list pgsql-general

From Richard Huxton
Subject Re: how do you set foriegn keys in pgaccess?
Date
Msg-id 42A96579.2070108@archonet.com
Whole thread Raw
In response to how do you set foriegn keys in pgaccess?  ("jeremy `" <norman1nz@hotmail.com>)
List pgsql-general
Don't forget to cc: the list.

jeremy ` wrote:
> yea sory I an using pgadmin3, and thats the prog that I'm not sure how
> to set foriegn keys with.

OK - to make a foreign key where bar.foo_ref references foo.foo_id you
should do the following:
1. Select table "bar" then "constraints"
2. Right-click and choose a new foreign-key
3. Give the foreign-key a name "my_first_foreign_key"
4. Drop down "references" to choose table "foo"
5. Click the "Columns" tab at the top of the dialogue-box
6. Choose local column = "foo_ref" and referenced = "foo_id"
7. Click the "Add" button
8. Click the "Action" tab and choose whether to restrict/cascade
9. Click OK

You should now see a new constraint on table bar, forcing "foo_ref" to
refer to values from table "foo" column "foo_id".

> What do I use for 'command line' features? do i need a separate program
> to pgadmin?

See the manuals - "client applications", they're all installed already.
I use psql almost exclusively. There I'd type something like:
   ALTER TABLE bar ADD CONSTRAINT my_first_constraint
   FOREIGN KEY (foo_ref) REFERENCES foo (foo_id)
   ON UPDATE RESTRICT ON DELETE RESTRICT;

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Dinesh Pandey"
Date:
Subject: Re: [SQL] Permission denied for language pltclu
Next
From: Richard Huxton
Date:
Subject: Re: [SQL] Permission denied for language pltclu