Thread: foreign key on views

foreign key on views

From
"Josh Harrison"
Date:
Hi,
Where in the source code can  I see the error message that says foreign key to a view is not allowed
The exact error message as it appears when I try foreign key reference on a  view is
 
     referenced relation "xyz_view" is not a table

I just wanted to know where is this error message thrown in the source code.?
Any help will be appreciated.
Thanks
josh

Re: foreign key on views

From
Tom Lane
Date:
"Josh Harrison" <joshques@gmail.com> writes:
> I just wanted to know where is this error message thrown in the source
> code.?

"\set VERBOSITY verbose" would help...

regression=# create view v as select * from int4_tbl;
CREATE VIEW
regression=# \set VERBOSITY verbose
regression=# create table t (f1 int references v);
ERROR:  42809: referenced relation "v" is not a table
LOCATION:  ATAddForeignKeyConstraint, tablecmds.c:3949

            regards, tom lane