Re: pg_dumpall and check constraints

From: JanWieck(at)t-online(dot)de (Jan Wieck)
To: Guillaume Perréal <perreal(at)lyon(dot)cemagref(dot)fr>
Cc: Philip Warner <pjw(at)rhyme(dot)com(dot)au>, pgsql-general(at)postgresql(dot)org
Subject: Re: pg_dumpall and check constraints
Date: 2000-06-30 15:56:19
Message-ID: 200006301556.RAA09536@hot.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Guillaume Perréal wrote:
> >
> > OR
> >
> > 2. create a view:
> > create view "station_fields" as select * from information where fieldname = 'station.type';
> >
> > then use:
> >
> > FOREIGN KEY ( "type") references "station_fields" ( code),
>
> I tried : it doesn't work. It seems that view rows don't have OID, which are used in foreign key. (I deduce that from the error messages I've got when I tried).
>

For gods sake they don't have. And I'm uncertain that it
should ever work.

The reason is that an FK constraint not only has to be
checked at INSERT/UPDATE time of the referencing table. It
must further ensure that later modifications to the
referenced table don't violate existing references. Now in
the case of a view that is a join over 3 tables, we setup a
multicolumn FK constraint over columns coming from different
base tables (or computed ones). How should a RESTRICT or ON
DELETE CASCADE work in that scenario?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2000-06-30 16:15:47 Re: Comments with embedded single quotes
Previous Message Tom Lane 2000-06-30 15:32:16 Re: Large Tables(>1 Gb)