postgresql/src/backend
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
..
access Teach nbtree to avoid evaluating row compare keys. 2025-09-15 16:56:49 -04:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Expand usage of macros for protocol characters. 2025-08-06 13:37:00 -05:00
bootstrap Add new OID alias type regdatabase. 2025-06-30 15:38:54 -05:00
catalog Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
commands Hide duplicate names from extension views 2025-09-15 07:30:31 +02:00
executor Eliminate duplicative hashtempcxt in nodeSubplan.c. 2025-09-10 16:15:08 -04:00
foreign Track the number of presorted outer pathkeys in MergePath 2025-05-08 18:21:32 +09:00
jit jit: fix build with LLVM-21 2025-09-15 08:31:11 +02:00
lib Correct list of files in src/backend/lib/README 2025-06-27 09:31:23 +09:00
libpq Remove hbaPort type 2025-09-15 11:04:10 +02:00
main Force LC_COLLATE to C in postmaster. 2025-07-16 14:13:18 -07:00
nodes Add Asserts to validate prevbit values in bms_prev_member 2025-08-15 16:33:07 +12:00
optimizer Treat JsonConstructorExpr as non-strict 2025-09-16 18:42:20 +09:00
parser Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
partitioning Avoid leakage of zero-length arrays in partition_bounds_copy(). 2025-08-02 21:59:46 -04:00
po Translation updates 2025-05-05 12:04:49 +02:00
port Remove traces of support for Sun Studio compiler 2025-09-12 07:39:05 +02:00
postmaster Fix incorrect const qualifier 2025-09-16 07:27:32 +02:00
regex Control ctype behavior internally with a method table. 2025-07-01 07:44:47 -07:00
replication Resume conflict-relevant data retention automatically. 2025-09-15 08:46:55 +00:00
rewrite Don't generate fake "*TLOCRN*" or "*TROCRN*" aliases, either. 2025-09-08 12:58:07 -04:00
snowball Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
statistics Avoid faulty alignment of Datums in build_sorted_items(). 2025-09-10 17:51:24 -04:00
storage Default to log_lock_waits=on 2025-09-12 07:57:06 +02:00
tcop CREATE STATISTICS: improve misleading error message 2025-09-15 11:43:34 +02:00
tsearch Remove useless/superfluous Datum conversions 2025-08-08 22:06:57 +02:00
utils Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile aio: Add liburing dependency 2025-03-26 19:45:32 -04:00
meson.build meson: add and use stamp files for generated headers 2025-08-11 15:18:23 -04:00
nls.mk Return yyparse() result not via global variable 2025-01-24 06:55:39 +01:00