Fix PK detection on inherited tables.
authorPetr Jelinek <pjmodos@pjmodos.net>
Wed, 25 Mar 2015 20:53:53 +0000 (21:53 +0100)
committerPetr Jelinek <pjmodos@pjmodos.net>
Wed, 25 Mar 2015 21:00:30 +0000 (22:00 +0100)
commit1dbfdad9a389169e69fe9770b02028d794a2b50c
tree685bf69e0417030e8eeb26fe1c37d4e6f44372e3
parent0b01d063132a5e61d522ffa9a2ce9a858e41d620
Fix PK detection on inherited tables.

We don't allow UPDATEs or DELETEs on tables without primary key but the
code for detecting if table has primary key didn't work correctly when
the UPDATE/DELETE was run on parent table which had primary key but the
command has propagated to an inherited table didn't have primary key.

In passing, fix the primary key detection for a less common use case:
WITH foo AS ( UPDATE table_without_pk ... RETURNING * )
INSERT INTO table_with_pk SELECT * FROM foo;
bdr_executor.c
expected/dml/missing_pk.out
sql/dml/missing_pk.sql