Re: how do you set foriegn keys in pgaccess?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: how do you set foriegn keys in pgaccess?
Дата
Msg-id 42A96579.2070108@archonet.com
обсуждение исходный текст
Ответ на how do you set foriegn keys in pgaccess?  ("jeremy `" <norman1nz@hotmail.com>)
Список 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 по дате отправления:

Предыдущее
От: "Dinesh Pandey"
Дата:
Сообщение: Re: [SQL] Permission denied for language pltclu
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: [SQL] Permission denied for language pltclu