pgsql: pg_get_partkeydef: return NULL for non-partitions

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: pg_get_partkeydef: return NULL for non-partitions
Date: 2017-04-26 18:59:44
Message-ID: E1d3SAC-0003ME-2a@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_get_partkeydef: return NULL for non-partitions

Our general rule for pg_get_X(oid) functions is to simply return NULL
when passed an invalid or inappropriate OID. Teach pg_get_partkeydef to
do this also, making it easier for users to use this function when
querying against tables with both partitions and non-partitions (such as
pg_class).

As a concrete example, this makes pg_dump's life a little easier.

Author: Amit Langote

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0c76c2463e8ab4cfd633ad8de259050e3f28b78f

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 20 ++++++++++++++------
src/test/regress/expected/rules.out | 6 ++++++
src/test/regress/sql/rules.sql | 1 +
3 files changed, 21 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2017-04-26 19:51:02 pgsql: doc PG10: add commit for transition table item
Previous Message Tom Lane 2017-04-26 18:01:28 pgsql: Silence compiler warning induced by commit de4389712.