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