diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-04-03 14:38:20 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-04-03 14:40:21 -0300 |
commit | f56f8f8da6afd8523b4d5284e02a20ed2b33ef8d (patch) | |
tree | e5f59afa60601ff9c2e92d7746df6dba57b73c99 /src/backend/utils/adt/ruleutils.c | |
parent | 9155580fd5fc2a0cbb23376dfca7cd21f59c2c7b (diff) | |
download | postgresql-f56f8f8da6afd8523b4d5284e02a20ed2b33ef8d.tar.gz postgresql-f56f8f8da6afd8523b4d5284e02a20ed2b33ef8d.zip |
Support foreign keys that reference partitioned tables
Previously, while primary keys could be made on partitioned tables, it
was not possible to define foreign keys that reference those primary
keys. Now it is possible to do that.
Author: Álvaro Herrera
Reviewed-by: Amit Langote, Jesper Pedersen
Discussion: https://postgr.es/m/20181102234158.735b3fevta63msbj@alvherre.pgsql
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 88dc09cae68..7b142e3b188 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -1837,6 +1837,24 @@ pg_get_partition_constraintdef(PG_FUNCTION_ARGS) } /* + * pg_get_partconstrdef_string + * + * Returns the partition constraint as a C-string for the input relation, with + * the given alias. No pretty-printing. + */ +char * +pg_get_partconstrdef_string(Oid partitionId, char *aliasname) +{ + Expr *constr_expr; + List *context; + + constr_expr = get_partition_qual_relid(partitionId); + context = deparse_context_for(aliasname, partitionId); + + return deparse_expression((Node *) constr_expr, context, true, false); +} + +/* * pg_get_constraintdef * * Returns the definition for the constraint, ie, everything that needs to |