Re: Possible bug in referential integrity system - Mailing list pgsql-bugs

From Alexei E Korneyev
Subject Re: Possible bug in referential integrity system
Date
Msg-id 002601c017c5$50f4f1c0$03b51ed4@niva.sposad.ru
Whole thread Raw
In response to Possible bug in referential integrity system  (Richard Ellis <rellis@erols.com>)
List pgsql-bugs
Hello!
Keys phrase 'NOT NULL'

simple=# create table t1 (num int4 PRIMARY KEY, name text);
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 't1_pkey' for
table 't1'
CREATE
simple=# create table t2 (ref int4 references t1 (num) NOT NULL, val text);
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
CREATE
simple=# insert into t1 values (1, 'Widget1');
INSERT 80324 1
simple=# insert into t2 values ( (select num from t1 where name =
'widget2'), 'Bug?');
ERROR:  ExecAppend: Fail to add null value in not null attribute ref

> => create table t1 (num int4, name text);
> CREATE
> => create table t2 (ref int4 references t1 (num), val text);
> NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
> CREATE
>
> => insert into t1 values (1, 'Widget1');
> INSERT 17518650 1
>
> => insert into t2 values ( (select num from t1 where name = 'Widget1'),
'Valuable');
> INSERT 17518651 1
> => insert into t2 values ( (select num from t1 where name = 'widget2'),
'Bug?');
> INSERT 17518652 1

Alexei E. Korneyev
alexei@niva.sposad.ru

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: /usr/include/pgsql/os.h does not exist
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: bug in date_part() function in 6.5.2, 7.0.2