postgresql/src/include/catalog/pg_operator.h
Tom Lane ba0faf81c6 Remove special BKI_LOOKUP magic for namespace and role OIDs.
Now that commit 62f34097c attached BKI_LOOKUP annotation to all the
namespace and role OID columns in the catalogs, there's no real reason
to have the magic PGNSP and PGUID symbols.  Get rid of them in favor
of implementing those lookups according to genbki.pl's normal pattern.

This means that in the catalog headers, BKI_DEFAULT(PGNSP) becomes
BKI_DEFAULT(pg_catalog), which seems a lot more transparent.
BKI_DEFAULT(PGUID) becomes BKI_DEFAULT(POSTGRES), which is perhaps
less so; but you can look into pg_authid.dat to discover that
POSTGRES is the nonce name for the bootstrap superuser.

This change also means that if we ever need cross-references in the
initial catalog data to any of the other built-in roles besides
POSTGRES, or to some other built-in schema besides pg_catalog,
we can just do it.

No catversion bump here, as there's no actual change in the contents
of postgres.bki.

Discussion: https://postgr.es/m/3240355.1612129197@sss.pgh.pa.us
2021-02-03 12:01:48 -05:00

107 lines
3.1 KiB
C

/*-------------------------------------------------------------------------
*
* pg_operator.h
* definition of the "operator" system catalog (pg_operator)
*
*
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_operator.h
*
* NOTES
* The Catalog.pm module reads this file and derives schema
* information.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_OPERATOR_H
#define PG_OPERATOR_H
#include "catalog/genbki.h"
#include "catalog/objectaddress.h"
#include "catalog/pg_operator_d.h"
#include "nodes/pg_list.h"
/* ----------------
* pg_operator definition. cpp turns this into
* typedef struct FormData_pg_operator
* ----------------
*/
CATALOG(pg_operator,2617,OperatorRelationId)
{
Oid oid; /* oid */
/* name of operator */
NameData oprname;
/* OID of namespace containing this oper */
Oid oprnamespace BKI_DEFAULT(pg_catalog) BKI_LOOKUP(pg_namespace);
/* operator owner */
Oid oprowner BKI_DEFAULT(POSTGRES) BKI_LOOKUP(pg_authid);
/* 'l' for prefix or 'b' for infix */
char oprkind BKI_DEFAULT(b);
/* can be used in merge join? */
bool oprcanmerge BKI_DEFAULT(f);
/* can be used in hash join? */
bool oprcanhash BKI_DEFAULT(f);
/* left arg type, or 0 if prefix operator */
Oid oprleft BKI_LOOKUP_OPT(pg_type);
/* right arg type */
Oid oprright BKI_LOOKUP(pg_type);
/* result datatype; can be 0 in a "shell" operator */
Oid oprresult BKI_LOOKUP_OPT(pg_type);
/* OID of commutator oper, or 0 if none */
Oid oprcom BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator);
/* OID of negator oper, or 0 if none */
Oid oprnegate BKI_DEFAULT(0) BKI_LOOKUP_OPT(pg_operator);
/* OID of underlying function; can be 0 in a "shell" operator */
regproc oprcode BKI_LOOKUP_OPT(pg_proc);
/* OID of restriction estimator, or 0 */
regproc oprrest BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
/* OID of join estimator, or 0 */
regproc oprjoin BKI_DEFAULT(-) BKI_LOOKUP_OPT(pg_proc);
} FormData_pg_operator;
/* ----------------
* Form_pg_operator corresponds to a pointer to a tuple with
* the format of pg_operator relation.
* ----------------
*/
typedef FormData_pg_operator *Form_pg_operator;
DECLARE_UNIQUE_INDEX_PKEY(pg_operator_oid_index, 2688, on pg_operator using btree(oid oid_ops));
#define OperatorOidIndexId 2688
DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, on pg_operator using btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops));
#define OperatorNameNspIndexId 2689
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);
extern void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete);
#endif /* PG_OPERATOR_H */