aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-09-08 17:28:04 -0400
committerRobert Haas <rhaas@postgresql.org>2017-09-08 17:28:04 -0400
commit6f6b99d1335be8ea1b74581fc489a97b109dd08a (patch)
tree2aaa59a9c8759a3195e7c1c27e96725ae3df944f /src/backend/utils/adt/ruleutils.c
parent2cf15ec8b1cb29bea149559700566a21a790b6d3 (diff)
downloadpostgresql-6f6b99d1335be8ea1b74581fc489a97b109dd08a.tar.gz
postgresql-6f6b99d1335be8ea1b74581fc489a97b109dd08a.zip
Allow a partitioned table to have a default partition.
Any tuples that don't route to any other partition will route to the default partition. Jeevan Ladhe, Beena Emerson, Ashutosh Bapat, Rahila Syed, and Robert Haas, with review and testing at various stages by (at least) Rushabh Lathia, Keith Fiske, Amit Langote, Amul Sul, Rajkumar Raghuanshi, Sven Kunze, Kyotaro Horiguchi, Thom Brown, Rafia Sabih, and Dilip Kumar. Discussion: http://postgr.es/m/CAH2L28tbN4SYyhS7YV1YBWcitkqbhSWfQCy0G=apRcC_PEO-bg@mail.gmail.com Discussion: http://postgr.es/m/CAOG9ApEYj34fWMcvBMBQ-YtqR9fTdXhdN82QEKG0SVZ6zeL1xg@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index f9ea7ed771d..0ea50782181 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1750,7 +1750,7 @@ pg_get_partition_constraintdef(PG_FUNCTION_ARGS)
constr_expr = get_partition_qual_relid(relationId);
- /* Quick exit if not a partition */
+ /* Quick exit if no partition constraint */
if (constr_expr == NULL)
PG_RETURN_NULL();
@@ -8699,6 +8699,12 @@ get_rule_expr(Node *node, deparse_context *context,
ListCell *cell;
char *sep;
+ if (spec->is_default)
+ {
+ appendStringInfoString(buf, "DEFAULT");
+ break;
+ }
+
switch (spec->strategy)
{
case PARTITION_STRATEGY_LIST: