Fix incorrect column name in error message for range partition bound check

Поиск
Список
Период
Сортировка
От myzhen
Тема Fix incorrect column name in error message for range partition bound check
Дата
Msg-id 273cab52.978.19b96fc75e7.Coremail.zhenmingyang@yeah.net
обсуждение исходный текст
Ответы Re: Fix incorrect column name in error message for range partition bound check
Список pgsql-hackers
Hi all,
Recently, while working with partitioned tables, I identified an issue where the error message references an incorrect column name when a range-partitioned table’s boundary values include MINVALUE or MAXVALUE. 

For example:

postgres=# CREATE TABLE pt_test_colname(a int, b int, c int) PARTITION BY RANGE(a, b);
-- right case
postgres=# CREATE TABLE pt_test_colname_p1 PARTITION OF pt_test_colname FOR VALUES FROM (10, now()) TO (100, 100);
ERROR: specified value cannot be cast to type integer for column "b"
LINE 1: ...PARTITION OF pt_test_colname FOR VALUES FROM (10, now()) TO ...
                                                             ^
-- wrong case
postgres=# CREATE TABLE pt_test_colname_p1 PARTITION OF pt_test_colname FOR VALUES FROM (minvalue, now()) TO (100, 100);
ERROR: specified value cannot be cast to type integer for column "a"
LINE 1: ...ION OF pt_test_colname FOR VALUES FROM (minvalue, now()) TO ...
                                                             ^
The datetime value returned by now() cannot be cast to the partition key b (integer type), yet the error message incorrectly attributes this casting failure to column a when the preceding boundary value is the special MINVALUE or MAXVALUE.
Вложения

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