49#define MAX_CACHED_PATH_LEN 16
116 errmsg(
"postfix operators are not supported"),
121 errmsg(
"operator does not exist: %s",
151 if (oprright ==
NULL)
207 lt_opr = typentry->
lt_opr;
208 eq_opr = typentry->
eq_opr;
209 gt_opr = typentry->
gt_opr;
217 errmsg(
"could not identify an ordering operator for type %s",
219 errhint(
"Use an explicit ordering operator or modify the query.")));
223 errmsg(
"could not identify an equality operator for type %s",
477 errmsg(
"operator requires run-time type coercion: %s",
635 errmsg(
"operator is not unique: %s",
637 errdetail(
"Could not choose a best candidate operator."),
638 errhint(
"You might need to add explicit type casts."),
643 errmsg(
"operator does not exist: %s",
671 return errdetail(
"There is no operator of that name.");
673 return errdetail(
"An operator of that name exists, but it is not in the search_path.");
681 (
void)
errdetail(
"No operator of that name accepts the given argument type.");
682 return errhint(
"You might need to add an explicit type cast.");
686 (
void)
errdetail(
"No operator of that name accepts the given argument types.");
687 return errhint(
"You might need to add explicit type casts.");
722 errmsg(
"postfix operators are not supported")));
746 errmsg(
"operator is only a shell: %s",
789 result->opfuncid =
opform->oprcode;
790 result->opresulttype = rettype;
797 if (result->opretset)
806 return (
Expr *) result;
847 errmsg(
"op ANY/ALL (array) requires array on right side"),
859 errmsg(
"operator is only a shell: %s",
888 errmsg(
"op ANY/ALL (array) requires operator to yield boolean"),
893 errmsg(
"op ANY/ALL (array) requires operator not to return a set"),
913 errmsg(
"could not find array type for data type %s",
926 result->opfuncid =
opform->oprcode;
929 result->
useOr = useOr;
936 return (
Expr *) result;
#define RegProcedureIsValid(p)
#define Assert(condition)
#define MemSet(start, val, len)
#define OidIsValid(objectId)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void CacheRegisterSyscacheCallback(SysCacheIdentifier cacheid, SyscacheCallbackFunction func, Datum arg)
bool get_func_retset(Oid funcid)
Oid get_base_element_type(Oid typid)
Oid getBaseType(Oid typid)
Oid get_array_type(Oid typid)
Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright)
char * NameListToString(const List *names)
Oid LookupExplicitNamespace(const char *nspname, bool missing_ok)
void DeconstructQualifiedName(const List *names, char **nspname_p, char **objname_p)
FuncCandidateList OpernameGetCandidates(List *names, char oprkind, bool missing_schema_ok, int *fgc_flags)
int fetch_search_path_array(Oid *sarray, int sarray_len)
Oid exprType(const Node *expr)
Oid enforce_generic_type_consistency(const Oid *actual_arg_types, Oid *declared_arg_types, int nargs, Oid rettype, bool allow_poly)
bool IsBinaryCoercible(Oid srctype, Oid targettype)
void make_fn_arguments(ParseState *pstate, List *fargs, Oid *actual_arg_types, Oid *declared_arg_types)
FuncCandidateList func_select_candidate(int nargs, Oid *input_typeids, FuncCandidateList candidates)
void check_srf_call_placement(ParseState *pstate, Node *last_srf, int location)
int func_match_argtypes(int nargs, Oid *input_typeids, FuncCandidateList raw_candidates, FuncCandidateList *candidates)
void cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
int parser_errposition(ParseState *pstate, int location)
void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location)
static void make_oper_cache_entry(OprCacheKey *key, Oid opr_oid)
static FuncDetailCode oper_select_candidate(int nargs, Oid *input_typeids, FuncCandidateList candidates, Oid *operOid)
Operator left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
static void InvalidateOprCacheCallBack(Datum arg, SysCacheIdentifier cacheid, uint32 hashvalue)
void get_sort_group_operators(Oid argtype, bool needLT, bool needEQ, bool needGT, Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, bool *isHashable)
#define MAX_CACHED_PATH_LEN
static int oper_lookup_failure_details(int fgc_flags, bool is_unary_op)
Expr * make_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree, Node *last_srf, int location)
Oid LookupOperName(ParseState *pstate, List *opername, Oid oprleft, Oid oprright, bool noError, int location)
Expr * make_scalar_array_op(ParseState *pstate, List *opname, bool useOr, Node *ltree, Node *rtree, int location)
Oid oprfuncid(Operator op)
static bool make_oper_cache_key(ParseState *pstate, OprCacheKey *key, List *opname, Oid ltypeId, Oid rtypeId, int location)
static HTAB * OprCacheHash
static void op_error(ParseState *pstate, List *op, Oid arg1, Oid arg2, FuncDetailCode fdresult, int fgc_flags, int location)
Operator oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, bool noError, int location)
static Oid binary_oper_exact(List *opname, Oid arg1, Oid arg2)
static Oid find_oper_cache_entry(OprCacheKey *key)
const char * op_signature_string(List *op, Oid arg1, Oid arg2)
Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError)
Operator compatible_oper(ParseState *pstate, List *op, Oid arg1, Oid arg2, bool noError, int location)
Oid LookupOperWithArgs(ObjectWithArgs *oper, bool noError)
Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, bool missing_ok)
static int list_length(const List *l)
#define linitial_node(type, l)
#define lsecond_node(type, l)
#define list_make2(x1, x2)
END_CATALOG_STRUCT typedef FormData_pg_operator * Form_pg_operator
size_t strlcpy(char *dst, const char *src, size_t siz)
static Datum ObjectIdGetDatum(Oid X)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendStringInfoString(StringInfo str, const char *s)
void initStringInfo(StringInfo str)
Oid search_path[MAX_CACHED_PATH_LEN]
char oprname[NAMEDATALEN]
Oid args[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
#define TYPECACHE_HASH_PROC