Re: Add check constraint bug

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Add check constraint bug
Дата
Msg-id 20020905154338.N72711-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Add check constraint bug  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Add check constraint bug  ("scott.marlowe" <scott.marlowe@ihs.com>)
Список pgsql-hackers
On Thu, 5 Sep 2002, Peter Eisentraut wrote:

> 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.


I don't have reasonable access to the machine at home for code purposes,
but it looks to me that the add column line is the one that's causing
the bug.  It's inserting a check constraint but not upping relchecks
which seems to work because it's zero and therefore doesn't even look, but
the add check is incrementing the count and inserting its constraint which
makes 2 real constraints and relchecks=1 which causes the error.

This is probably also why it forgets about the check constraint below
since relchecks is 0, but I didn't look.

Note that:
create table test(a int check (a>3));
alter table test add column b text check(b<>'');
select * from test;

will error.




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: Inheritance
Следующее
От: Hannu Krosing
Дата:
Сообщение: Re: beta1 packaged