]> granicus.if.org Git - postgresql/commit
Change the way pg_dump retrieves partitioning info
authorStephen Frost <sfrost@snowman.net>
Fri, 5 May 2017 02:17:52 +0000 (22:17 -0400)
committerStephen Frost <sfrost@snowman.net>
Fri, 5 May 2017 02:17:52 +0000 (22:17 -0400)
commit44c528810a1eca52a7888ed74c08353d45331b00
tree9e1914b98f31f453fea6244e8c6dda0532a913f3
parent5469e44ffc2077cb8371686497022cb5afd1af87
Change the way pg_dump retrieves partitioning info

This gets rid of the code that issued separate queries to retrieve the
partitioning parent-child relationship, parent partition key, and child
partition bound information.  With this patch, the information is
retrieved instead using the queries issued from getTables() and
getInherits(), which is both more efficient than the previous approach
and doesn't require any new code.

Since the partitioning parent-child relationship is now retrieved with
the same old code that handles inheritance, partition attributes receive
a proper flagInhAttrs() treatment (that it didn't receive before), which
is needed so that the inherited NOT NULL constraints are not emitted if
we already emitted it for the parent.

Also, fix a bug in pg_dump's --binary-upgrade code, which caused pg_dump
to emit invalid command to attach a partition to its parent.

Author: Amit Langote, with some additional changes by me.
src/bin/pg_dump/common.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/t/002_pg_dump.pl