Add check constraint bug - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Add check constraint bug
Date
Msg-id Pine.LNX.4.44.0209052239260.945-100000@localhost.localdomain
Whole thread Raw
Responses Re: Add check constraint bug
Re: Add check constraint bug
List pgsql-hackers
The following happens in latest CVS and a fresh database:

create table test (a int);
insert into test values (1);
alter table test add column b text check (b <> '');
alter table test add check (a > 0);
alter table test add check (a <> 1);

After the last command I get

ERROR:  CheckConstraintFetch: unexpected record found for rel test

and then the table seems to be wedged because any access to it will get
the same error.

Also, psql seems to forget about check constraints in peculiar ways:

create table test (a int);
insert into test values (1);
alter table test add column b text check (b <> '');
\d test
alter table test add check (a > 0);
\d test

The first shows:
    Table "public.test"Spalte |   Typ   | Attribute
--------+---------+-----------a      | integer |b      | text    |

The second shows:
    Table "public.test"Spalte |   Typ   | Attribute
--------+---------+-----------a      | integer |b      | text    |
Check-Constraints: »test_b« (b <> ''::text)                  »$1« (a > 0)

Note the first one doesn't show any constraints.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: beta1 packaged
Next
From: Peter Eisentraut
Date:
Subject: Re: Multibyte support in oracle_compat.c