Problem with alter table (creating a foreing key post facto)

Поиск
Список
Период
Сортировка
От Emmanuel Charpentier
Тема Problem with alter table (creating a foreing key post facto)
Дата
Msg-id b0it8a$qbe$1@news.hub.org
обсуждение исходный текст
Ответы Re: Problem with alter table (creating a foreing key post  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: Problem with alter table (creating a foreing key post facto)  (Dennis Gearon <gearond@cvc.net>)
Список pgsql-general
A curious problem with 7.3.1 : I wanted to add a foreing key constraint to
a table already created and populated. No way, according to Postgres :

Welcome to psql 7.3.1, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
        \h for help with SQL commands
        \? for help on internal slash commands
        \g or terminate with semicolon to execute query
        \q to quit

essai=# \d tablea
                             Table "public.tablea"
  Column |  Type   |                        Modifiers
--------+---------+----------------------------------------------------------
  keya   | integer | not null default nextval('public.tablea_keya_seq'::text)
  vala   | text    |
Indexes: tablea_pkey primary key btree (keya)

essai=# \d tableb
                             Table "public.tableb"
  Column |  Type   |                        Modifiers
--------+---------+----------------------------------------------------------
  keyb   | integer | not null default nextval('public.tableb_keyb_seq'::text)
  refa   | integer | not null
  valb   | text    |
Indexes: tableb_pkey primary key btree (keyb)

essai=# alter table tableb add constraint lien_a_a foreing key (refa)
references tablea (keya);
ERROR:  parser: parse error at or near "foreing" at character 44
essai=# alter table tableb add foreing key (refa) references tablea (keya);
ERROR:  parser: parse error at or near "(" at character 36

WTF ????

Any ideas ?

Sincerely,

                    Emmanuel Charpentier


В списке pgsql-general по дате отправления:

Предыдущее
От: CSN
Дата:
Сообщение: grant to all tables
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Problem with alter table (creating a foreing key post