1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

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.
This commit is contained in:
Andres Freund
2015-05-19 21:17:52 +02:00
parent b48437d11b
commit 0740cbd759
8 changed files with 31 additions and 35 deletions

View File

@ -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);
}