BUG #8408: Not exactly correct error messages for failed check in presence of dropped columns.

From: maxim(dot)boguk(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8408: Not exactly correct error messages for failed check in presence of dropped columns.
Date: 2013-08-30 05:13:41
Message-ID: E1VFH1h-0002tY-Nt@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8408
Logged by: Maxim Boguk
Email address: maxim(dot)boguk(at)gmail(dot)com
PostgreSQL version: 9.2.4
Operating system: Any
Description:

There are simple test case:

create table test_columns (id serial primary key, value int
check(value<10));
NOTICE: CREATE TABLE will create implicit sequence "test_columns_id_seq"
for serial column "test_columns.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"test_columns_pkey" for table "test_columns"
CREATE TABLE

insert into test_columns(value) values (100);
ERROR: new row for relation "test_columns" violates check constraint
"test_columns_value_check"
DETAIL: Failing row contains (1, 100).

--it's ok...
--now let drop value column and add new one

alter table test_columns drop column value;
ALTER TABLE

alter table test_columns add column "value" int check (value < 10);
ALTER TABLE

insert into test_columns(value) values (100);
ERROR: new row for relation "test_columns" violates check constraint
"test_columns_value_check"
DETAIL: Failing row contains (2, null, 100).

-- now (2, null, 100) sound weird...

And yes I completely understand where this NULL came from and why this
happened.

However, I think error message should filter dropped column and strange null
values (because if a table has a lot dropped column this error message
quickly become completely unreadable).

Regards,
Maksym

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2013-08-30 18:33:40 Re: BUG #8400: DB size changed after restore
Previous Message Andres Freund 2013-08-29 23:11:38 Re: BUG #8407: json_populate_record case sensitivity