postgresql/src/include/parser
Tom Lane 83a5641945 Provide more-specific error details/hints for function lookup failures.
Up to now we've contented ourselves with a one-size-fits-all error
hint when we fail to find any match to a function or procedure call.
That was mostly okay in the beginning, but it was never great, and
since the introduction of named arguments it's really not adequate.
We at least ought to distinguish "function name doesn't exist" from
"function name exists, but not with those argument names".  And the
rules for named-argument matching are arcane enough that some more
detail seems warranted if we match the argument names but the call
still doesn't work.

This patch creates a framework for dealing with these problems:
FuncnameGetCandidates and related code will now pass back a bitmask of
flags showing how far the match succeeded.  This allows a considerable
amount of granularity in the reports.  The set-bits-in-a-bitmask
approach means that when there are multiple candidate functions, the
report will reflect the match(es) that got the furthest, which seems
correct.  Also, we can avoid mentioning "maybe add casts" unless
failure to match argument types is actually the issue.

Extend the same return-a-bitmask approach to OpernameGetCandidates.
The issues around argument names don't apply to operator syntax,
but it still seems worth distinguishing between "there is no
operator of that name" and "we couldn't match the argument types".

While at it, adjust these messages and related ones to more strictly
separate "detail" from "hint", following our message style guidelines'
distinction between those.

Reported-by: Dominique Devienne <ddevienne@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/1756041.1754616558@sss.pgh.pa.us
2025-09-16 12:17:02 -04:00
..
analyze.h Change SQL-language functions to use the plan cache. 2025-04-02 14:06:02 -04:00
kwlist.h Extend ALTER DEFAULT PRIVILEGES to define default privileges for large objects. 2025-04-04 19:02:17 +09:00
parse_agg.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_clause.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_coerce.h Handle default NULL insertion a little better. 2025-01-29 15:31:55 -05:00
parse_collate.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_cte.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_enr.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_expr.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_func.h Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
parse_merge.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_node.h Revert support for improved tracking of nested queries 2025-06-12 10:08:55 +09:00
parse_oper.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_param.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_relation.h pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
parse_target.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_type.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parse_utilcmd.h Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
parser.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
parsetree.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
scanner.h pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
scansup.h Update copyright for 2025 2025-01-01 11:21:55 -05:00