mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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
This commit is contained in:
@ -1836,6 +1836,24 @@ pg_get_partition_constraintdef(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_TEXT_P(string_to_text(consrc));
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
|
Reference in New Issue
Block a user