From 0dab5ef39b3d9d86e45bbbb2f6ea60b4f5517d9a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 31 Dec 2015 17:37:31 -0500 Subject: Fix ALTER OPERATOR to update dependencies properly. Fix an oversight in commit 321eed5f0f7563a0: replacing an operator's selectivity functions needs to result in a corresponding update in pg_depend. We have a function that can handle that, but it was not called by AlterOperator(). To fix this without enlarging pg_operator.h's #include list beyond what clients can safely include, split off the function definitions into a new file pg_operator_fn.h, similarly to what we've done for some other catalog header files. It's not entirely clear whether any client-side code needs to include pg_operator.h, but it seems prudent to assume that there is some such code somewhere. --- src/backend/commands/operatorcmds.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/backend/commands/operatorcmds.c') diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index 0bb9743ea36..67d266cd745 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -40,6 +40,7 @@ #include "catalog/indexing.h" #include "catalog/objectaccess.h" #include "catalog/pg_operator.h" +#include "catalog/pg_operator_fn.h" #include "catalog/pg_type.h" #include "commands/alter.h" #include "commands/defrem.h" @@ -500,9 +501,9 @@ AlterOperator(AlterOperatorStmt *stmt) simple_heap_update(catalog, &tup->t_self, tup); CatalogUpdateIndexes(catalog, tup); - InvokeObjectPostAlterHook(OperatorRelationId, oprId, 0); + address = makeOperatorDependencies(tup, true); - ObjectAddressSet(address, OperatorRelationId, oprId); + InvokeObjectPostAlterHook(OperatorRelationId, oprId, 0); heap_close(catalog, NoLock); -- cgit v1.2.3