pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mister ics <mister_ics@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: on update restrict
Date: Tue, 14 Aug 2001 11:33:42
Message-ID: <F2139wPiyAphwFutJLt00006fb6@hotmail.com> (raw)

Hi,

I'm a little confused by the "on update restrict" option in a referential 
integrity constraint. I don't know if i have not understood the meaning of 
this statement or it does not work properly.
I think that if it is specified ON UPDATE RESTRICT in a foreign key 
costraint, the sql-server should not perform updates on the referenced rows. 
Here an example:

testdb=>create table t1 (
	id int primary key,
	foo int);
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 't1_pkey' for 
table 't1'
CREATE

testdb=>create table t2 (
	id int primary key,
	ref int references t1(id) on update restrict);
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 't2_pkey' for 
table 't2'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY 
check(s)
CREATE

testdb=>insert into t1 values (1,3000);
INSERT 19116 1
testdb=>insert into t2 values (1,1);
INSERT 19117 1

testdb=> update t1 set foo=2900 where id=1;
UPDATE 1    <--- for me is wrong, we have updated a row referenced by t2 
with ON UPDATE RESTRICT OPTION

What do you think about ?

Thanks in advance

Regards,
	 Silvio



_________________________________________________________________
Scarica GRATUITAMENTE MSN Explorer all'indirizzo 
http://explorer.msn.it/intl.asp




view thread (5+ messages)  latest in thread

Message-ID: <F2139wPiyAphwFutJLt00006fb6@hotmail.com>
Permalink:  ../F2139wPiyAphwFutJLt00006fb6@hotmail.com/
Also on:    postgresql.org/message-id/F2139wPiyAphwFutJLt00006fb6@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mister_ics@hotmail.com
  Subject: Re: on update restrict
  In-Reply-To: <F2139wPiyAphwFutJLt00006fb6@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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