@@ -75,8 +75,9 @@ static const char *op_signature_string(List *op, char oprkind,
7575static void op_error (ParseState * pstate , List * op , char oprkind ,
7676 Oid arg1 , Oid arg2 ,
7777 FuncDetailCode fdresult , int location );
78- static bool make_oper_cache_key (OprCacheKey * key , List * opname ,
79- Oid ltypeId , Oid rtypeId );
78+ static bool make_oper_cache_key (ParseState * pstate , OprCacheKey * key ,
79+ List * opname , Oid ltypeId , Oid rtypeId ,
80+ int location );
8081static Oid find_oper_cache_entry (OprCacheKey * key );
8182static void make_oper_cache_entry (OprCacheKey * key , Oid opr_oid );
8283static void InvalidateOprCacheCallBack (Datum arg , int cacheid , uint32 hashvalue );
@@ -383,7 +384,8 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId,
383384 /*
384385 * Try to find the mapping in the lookaside cache.
385386 */
386- key_ok = make_oper_cache_key (& key , opname , ltypeId , rtypeId );
387+ key_ok = make_oper_cache_key (pstate , & key , opname , ltypeId , rtypeId , location );
388+
387389 if (key_ok )
388390 {
389391 operOid = find_oper_cache_entry (& key );
@@ -529,7 +531,8 @@ right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
529531 /*
530532 * Try to find the mapping in the lookaside cache.
531533 */
532- key_ok = make_oper_cache_key (& key , op , arg , InvalidOid );
534+ key_ok = make_oper_cache_key (pstate , & key , op , arg , InvalidOid , location );
535+
533536 if (key_ok )
534537 {
535538 operOid = find_oper_cache_entry (& key );
@@ -607,7 +610,8 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
607610 /*
608611 * Try to find the mapping in the lookaside cache.
609612 */
610- key_ok = make_oper_cache_key (& key , op , InvalidOid , arg );
613+ key_ok = make_oper_cache_key (pstate , & key , op , InvalidOid , arg , location );
614+
611615 if (key_ok )
612616 {
613617 operOid = find_oper_cache_entry (& key );
@@ -1006,9 +1010,13 @@ static HTAB *OprCacheHash = NULL;
10061010 *
10071011 * Returns TRUE if successful, FALSE if the search_path overflowed
10081012 * (hence no caching is possible).
1013+ *
1014+ * pstate/location are used only to report the error position; pass NULL/-1
1015+ * if not available.
10091016 */
10101017static bool
1011- make_oper_cache_key (OprCacheKey * key , List * opname , Oid ltypeId , Oid rtypeId )
1018+ make_oper_cache_key (ParseState * pstate , OprCacheKey * key , List * opname ,
1019+ Oid ltypeId , Oid rtypeId , int location )
10121020{
10131021 char * schemaname ;
10141022 char * opername ;
@@ -1026,8 +1034,12 @@ make_oper_cache_key(OprCacheKey *key, List *opname, Oid ltypeId, Oid rtypeId)
10261034
1027 <
6D40
td data-grid-cell-id="diff-e794bad1a9e5286956746d72ee7989d6392175e6fd0bb4bfeaeb894fc206e126-1027-1035-1" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">1035 if (schemaname )
10281036 {
1037+ ParseCallbackState pcbstate ;
1038+
10291039 /* search only in exact schema given */
1040+ setup_parser_errposition_callback (& pcbstate , pstate , location );
10301041 key -> search_path [0 ] = LookupExplicitNamespace (schemaname , false);
1042+ cancel_parser_errposition_callback (& pcbstate );
10311043 }
10321044 else
10331045 {
0 commit comments