MCPcopy Create free account
hub / github.com/apache/cloudberry / make_oper_cache_key

Function make_oper_cache_key

src/backend/parser/parse_oper.c:949–985  ·  view source on GitHub ↗

* make_oper_cache_key * Fill the lookup key struct given operator name and arg types. * * Returns true if successful, false if the search_path overflowed * (hence no caching is possible). * * pstate/location are used only to report the error position; pass NULL/-1 * if not available. */

Source from the content-addressed store, hash-verified

947 * if not available.
948 */
949static bool
950make_oper_cache_key(ParseState *pstate, OprCacheKey *key, List *opname,
951 Oid ltypeId, Oid rtypeId, int location)
952{
953 char *schemaname;
954 char *opername;
955
956 /* deconstruct the name list */
957 DeconstructQualifiedName(opname, &schemaname, &opername);
958
959 /* ensure zero-fill for stable hashing */
960 MemSet(key, 0, sizeof(OprCacheKey));
961
962 /* save operator name and input types into key */
963 strlcpy(key->oprname, opername, NAMEDATALEN);
964 key->left_arg = ltypeId;
965 key->right_arg = rtypeId;
966
967 if (schemaname)
968 {
969 ParseCallbackState pcbstate;
970
971 /* search only in exact schema given */
972 setup_parser_errposition_callback(&pcbstate, pstate, location);
973 key->search_path[0] = LookupExplicitNamespace(schemaname, false);
974 cancel_parser_errposition_callback(&pcbstate);
975 }
976 else
977 {
978 /* get the active search path */
979 if (fetch_search_path_array(key->search_path,
980 MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN)
981 return false; /* oops, didn't fit */
982 }
983
984 return true;
985}
986
987/*
988 * find_oper_cache_entry

Callers 2

operFunction · 0.85
left_operFunction · 0.85

Calls 6

DeconstructQualifiedNameFunction · 0.85
strlcpyFunction · 0.85
LookupExplicitNamespaceFunction · 0.85
fetch_search_path_arrayFunction · 0.85

Tested by

no test coverage detected