Re: Sometimes referential integrity seems not to work

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Enio Schutt Junior <enio(at)pmpf(dot)rs(dot)gov(dot)br>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Sometimes referential integrity seems not to work
Date: 2004-01-31 23:40:48
Message-ID: 9148.1075592448@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> On Mon, 26 Jan 2004, Enio Schutt Junior wrote:
>> In a database I am working, I sometimes have to delete all the records in
>> some tables. According to the referential integrity defined in the creation
>> of the tables, postmaster should not delete the records, but it does. I have
>> used the following commands: "delete from table_1" and "truncate table_1".
>> ...
>> can the postgres user delete records despite referential integrity?

> It shouldn't. Can you give your version information and a complete
> standalone example?

I think the first PG release or two that had TRUNCATE TABLE would allow
you to apply it despite the existence of foreign-key constraints on the
table. Recent releases won't though.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2004-02-01 05:48:12 Re: Sometimes referential integrity seems not to work
Previous Message LawyerKill 2004-01-31 21:50:06 REPLACE