From 0740cbd7593d871858c352fab29a59cf7fa54b00 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 19 May 2015 21:17:52 +0200 Subject: Refactor ON CONFLICT index inference parse tree representation. Defer lookup of opfamily and input type of a of a user specified opclass until the optimizer selects among available unique indexes; and store the opclass in the parse analyzed tree instead. The primary reason for doing this is that for rule deparsing it's easier to use the opclass than the previous representation. While at it also rename a variable in the inference code to better fit it's purpose. This is separate from the actual fixes for deparsing to make review easier. --- src/backend/parser/parse_clause.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/backend/parser/parse_clause.c') diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index a90bcf40c9d..c8af5ab1d05 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -2730,18 +2730,10 @@ resolve_unique_index_expr(ParseState *pstate, InferClause *infer, exprLocation(pInfer->expr)); if (!ielem->opclass) - { - pInfer->inferopfamily = InvalidOid; - pInfer->inferopcinputtype = InvalidOid; - } + pInfer->inferopclass = InvalidOid; else - { - Oid opclass = get_opclass_oid(BTREE_AM_OID, ielem->opclass, - false); - - pInfer->inferopfamily = get_opclass_family(opclass); - pInfer->inferopcinputtype = get_opclass_input_type(opclass); - } + pInfer->inferopclass = get_opclass_oid(BTREE_AM_OID, + ielem->opclass, false); result = lappend(result, pInfer); } -- cgit v1.2.3