pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Break referential integrity.
3+ messages / 3 participants
[nested] [flat]

* Break referential integrity.
@ 2003-07-02 03:59  Rudi Starcevic <rudi@oasis.net.au>
  0 siblings, 1 reply; 3+ messages in thread

From: Rudi Starcevic @ 2003-07-02 03:59 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I know that if you have a trigger and function then drop/replace the 
function the trigger needs
to be drop/replaced too so that it can see the new function.

Is it the same for Ref. Integ. on table's too ?

If table B's foreign key references table A and you drop/replace table A
then the reference from table B to table A is broken and needs to be 
recreated ?

Hope I explained that OK.

Thanks
Rudi.






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Break referential integrity.
@ 2003-07-02 04:14  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Rudi Starcevic <rudi@oasis.net.au>
  0 siblings, 1 reply; 3+ messages in thread

From: Stephan Szabo @ 2003-07-02 04:14 UTC (permalink / raw)
  To: Rudi Starcevic <rudi@oasis.net.au>; +Cc: pgsql-sql

On Wed, 2 Jul 2003, Rudi Starcevic wrote:

> Hi,
>
> I know that if you have a trigger and function then drop/replace the
> function the trigger needs
> to be drop/replaced too so that it can see the new function.
>
> Is it the same for Ref. Integ. on table's too ?
>
> If table B's foreign key references table A and you drop/replace table A
> then the reference from table B to table A is broken and needs to be
> recreated ?

In recent versions, you should not be drop table A without specifying
cascade which will drop the constraint for you (and thus you'll need to
recreate it).  In older versions, I'm not 100% sure what'd happen, but you
probably should drop and recreate it for good measure.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Break referential integrity.
@ 2003-07-09 19:06  Jan Wieck <JanWieck@Yahoo.com>
  parent: Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Jan Wieck @ 2003-07-09 19:06 UTC (permalink / raw)
  To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: Rudi Starcevic <rudi@oasis.net.au>; pgsql-sql

Stephan Szabo wrote:
> On Wed, 2 Jul 2003, Rudi Starcevic wrote:
> 
>> Hi,
>>
>> I know that if you have a trigger and function then drop/replace the
>> function the trigger needs
>> to be drop/replaced too so that it can see the new function.
>>
>> Is it the same for Ref. Integ. on table's too ?
>>
>> If table B's foreign key references table A and you drop/replace table A
>> then the reference from table B to table A is broken and needs to be
>> recreated ?
> 
> In recent versions, you should not be drop table A without specifying
> cascade which will drop the constraint for you (and thus you'll need to
> recreate it).  In older versions, I'm not 100% sure what'd happen, but you
> probably should drop and recreate it for good measure.

Older versions spit out a NOTICE and dropped the constraint, so they 
kinda defaulted to CASCADE.


Jan

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-07-09 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-02 03:59 Break referential integrity. Rudi Starcevic <rudi@oasis.net.au>
2003-07-02 04:14 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2003-07-09 19:06   ` Jan Wieck <JanWieck@Yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox