Possible bug in FOREIGN KEY

Поиск
Список
Период
Сортировка
От Michael J Schout
Тема Possible bug in FOREIGN KEY
Дата
Msg-id Pine.LNX.4.10.10007271908540.17609-100000@galaxy.gkg-com.com
обсуждение исходный текст
Список pgsql-hackers
(sorry for sending this 2x.  I accidently omitted the Subject on the first
copy)

----------------

Didn't know if this is a known issue or not, but  I think the following ought to fail, and it does not:

mschout=# create table foo (f1 int not null, primary key (f1));
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'foo_pkey' for table 'foo'
CREATE

so far, so good.

now the problem:

create table bar (   f2 int not null,   foreign key (blah) REFERENCES foo (f1) ON DELETE RESTRICT
);

I think this *should* fail since "blah" isn't defined in the table anywhere.

the result:
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE

Note that column "blah" doesnt actually exist.  Shouldn't we complain and bail
out from the create in this case?  A typeo in a FOREIGN KEY clause would bypass
the restriction altogether. 

The only reason I can think where this might be desired is if the table created
INHERITS some other table (that might have column "blah" in it).  Maybe there
is some easy way to check that though?

This is on postgreSQL 7.0.2, Redhat Linux 6.2

Anyways, figured I better report this in case its not a known issue :)

Mike




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

Предыдущее
От: Michael J Schout
Дата:
Сообщение: ...
Следующее
От: Philip Warner
Дата:
Сообщение: pg_dump and ANSI types (TODO item)