]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix list partition constraints for partition keys of array type.
authorRobert Haas <rhaas@postgresql.org>
Wed, 31 Jan 2018 20:43:11 +0000 (15:43 -0500)
committerRobert Haas <rhaas@postgresql.org>
Wed, 31 Jan 2018 21:08:39 +0000 (16:08 -0500)
commit86fba28657858307bb27d4d7e3a9ef053ac0c2b4
tree9a2e9351e1e50dc9fcc7b8713c3dfafe126d50b5
parent167a22b2a624531fe106e1564bc5f62e275a036d
Fix list partition constraints for partition keys of array type.

The old code generated always generated a constraint of the form
col = ANY(ARRAY[val1, val2, ...]), but that's invalid when col is an
array type.  Instead, generate col = val when there's only one value,
col = val1 OR col = val2 OR ... when there are multiple values and
col is of array type, and the old form when there are multiple values
and col is not of an array type.

As a side benefit, this makes constraint exclusion able to prune
a list partition declared to accept a single Boolean value, which
didn't work before.

Amit Langote, reviewed by Etsuro Fujita

Discussion: http://postgr.es/m/97267195-e235-89d1-a41a-c110198dfce9@lab.ntt.co.jp
src/backend/catalog/partition.c
src/test/regress/expected/create_table.out
src/test/regress/expected/foreign_data.out
src/test/regress/sql/create_table.sql