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.
This commit is contained in:
Tom Lane
2015-12-31 17:37:31 -05:00
parent e5d06f2b12
commit 0dab5ef39b
6 changed files with 163 additions and 42 deletions

View File

@ -23,8 +23,6 @@
#define PG_OPERATOR_H
#include "catalog/genbki.h"
#include "catalog/objectaddress.h"
#include "nodes/pg_list.h"
/* ----------------
* pg_operator definition. cpp turns this into
@ -1826,19 +1824,4 @@ DESCR("delete array element");
DATA(insert OID = 3287 ( "#-" PGNSP PGUID b f f 3802 1009 3802 0 0 jsonb_delete_path - - ));
DESCR("delete path");
/*
* function prototypes
*/
extern ObjectAddress OperatorCreate(const char *operatorName,
Oid operatorNamespace,
Oid leftTypeId,
Oid rightTypeId,
Oid procedureId,
List *commutatorName,
List *negatorName,
Oid restrictionId,
Oid joinId,
bool canMerge,
bool canHash);
#endif /* PG_OPERATOR_H */

View File

@ -0,0 +1,34 @@
/*-------------------------------------------------------------------------
*
* pg_operator_fn.h
* prototypes for functions in catalog/pg_operator.c
*
*
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_operator_fn.h
*
*-------------------------------------------------------------------------
*/
#ifndef PG_OPERATOR_FN_H
#define PG_OPERATOR_FN_H
#include "catalog/objectaddress.h"
#include "nodes/pg_list.h"
extern ObjectAddress OperatorCreate(const char *operatorName,
Oid operatorNamespace,
Oid leftTypeId,
Oid rightTypeId,
Oid procedureId,
List *commutatorName,
List *negatorName,
Oid restrictionId,
Oid joinId,
bool canMerge,
bool canHash);
extern ObjectAddress makeOperatorDependencies(HeapTuple tuple, bool isUpdate);
#endif /* PG_OPERATOR_FN_H */