mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
blanks, in hopes of reducing the surprise factor for newbies. Remove redundant operators for VARCHAR (it depends wholly on TEXT operations now). Clean up resolution of ambiguous operators/functions to avoid surprising choices for domains: domains are treated as equivalent to their base types and binary-coercibility is no longer considered a preference item when choosing among multiple operators/functions. IsBinaryCoercible now correctly reflects the notion that you need *only* relabel the type to get from type A to type B: that is, a domain is binary-coercible to its base type, but not vice versa. Various marginal cleanup, including merging the essentially duplicate resolution code in parse_func.c and parse_oper.c. Improve opr_sanity regression test to understand about binary compatibility (using pg_cast), and fix a couple of small errors in the catalogs revealed thereby. Restructure "special operator" handling to fetch operators via index opclasses rather than hardwiring assumptions about names (cleans up the pattern_ops stuff a little).
89 lines
3.6 KiB
C
89 lines
3.6 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* lsyscache.h
|
|
* Convenience routines for common queries in the system catalog cache.
|
|
*
|
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $Id: lsyscache.h,v 1.70 2003/05/26 00:11:28 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef LSYSCACHE_H
|
|
#define LSYSCACHE_H
|
|
|
|
#include "access/htup.h"
|
|
|
|
extern bool op_in_opclass(Oid opno, Oid opclass);
|
|
extern bool op_requires_recheck(Oid opno, Oid opclass);
|
|
extern Oid get_opclass_member(Oid opclass, int16 strategy);
|
|
extern char *get_attname(Oid relid, AttrNumber attnum);
|
|
extern AttrNumber get_attnum(Oid relid, const char *attname);
|
|
extern Oid get_atttype(Oid relid, AttrNumber attnum);
|
|
extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
|
|
extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
|
|
Oid *typid, int32 *typmod);
|
|
extern bool opclass_is_btree(Oid opclass);
|
|
extern RegProcedure get_opcode(Oid opno);
|
|
extern char *get_opname(Oid opno);
|
|
extern bool op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp);
|
|
extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
|
|
RegProcedure *ltproc, RegProcedure *gtproc);
|
|
extern bool op_hashjoinable(Oid opno);
|
|
extern bool op_strict(Oid opno);
|
|
extern char op_volatile(Oid opno);
|
|
extern Oid get_commutator(Oid opno);
|
|
extern Oid get_negator(Oid opno);
|
|
extern RegProcedure get_oprrest(Oid opno);
|
|
extern RegProcedure get_oprjoin(Oid opno);
|
|
extern char *get_func_name(Oid funcid);
|
|
extern Oid get_func_rettype(Oid funcid);
|
|
extern bool get_func_retset(Oid funcid);
|
|
extern bool func_strict(Oid funcid);
|
|
extern char func_volatile(Oid funcid);
|
|
extern Oid get_relname_relid(const char *relname, Oid relnamespace);
|
|
extern Oid get_system_catalog_relid(const char *catname);
|
|
extern char *get_rel_name(Oid relid);
|
|
extern Oid get_rel_namespace(Oid relid);
|
|
extern Oid get_rel_type_id(Oid relid);
|
|
extern char get_rel_relkind(Oid relid);
|
|
extern bool get_typisdefined(Oid typid);
|
|
extern int16 get_typlen(Oid typid);
|
|
extern bool get_typbyval(Oid typid);
|
|
extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
|
|
extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
|
|
char *typalign);
|
|
extern char get_typstorage(Oid typid);
|
|
extern int32 get_typtypmod(Oid typid);
|
|
extern Node *get_typdefault(Oid typid);
|
|
extern char get_typtype(Oid typid);
|
|
extern Oid get_typ_typrelid(Oid typid);
|
|
extern Oid get_element_type(Oid typid);
|
|
extern Oid get_array_type(Oid typid);
|
|
extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typElem);
|
|
extern void getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
|
|
bool *typIsVarlena);
|
|
extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typElem);
|
|
extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, Oid *typElem,
|
|
bool *typIsVarlena);
|
|
extern Oid getBaseType(Oid typid);
|
|
extern int32 get_typavgwidth(Oid typid, int32 typmod);
|
|
extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
|
|
extern bool get_attstatsslot(HeapTuple statstuple,
|
|
Oid atttype, int32 atttypmod,
|
|
int reqkind, Oid reqop,
|
|
Datum **values, int *nvalues,
|
|
float4 **numbers, int *nnumbers);
|
|
extern void free_attstatsslot(Oid atttype,
|
|
Datum *values, int nvalues,
|
|
float4 *numbers, int nnumbers);
|
|
extern char *get_namespace_name(Oid nspid);
|
|
extern int32 get_usesysid(const char *username);
|
|
|
|
#define is_array_type(typid) (get_element_type(typid) != InvalidOid)
|
|
|
|
#define TypeIsToastable(typid) (get_typstorage(typid) != 'p')
|
|
|
|
#endif /* LSYSCACHE_H */
|