postgresql/src/include
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 Improve comment about snapshot macros 2025-09-11 19:49:57 +02:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Add backup_type column to pg_stat_progress_basebackup. 2025-08-05 10:50:45 -07:00
bootstrap Allow redeclaration of typedef yyscan_t 2025-09-12 08:16:00 +02:00
catalog Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
commands Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
common Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
datatype Avoid using timezone Asia/Manila in regression tests. 2025-01-20 15:47:53 -05:00
executor Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
fe_utils Allow redeclaration of typedef yyscan_t 2025-09-12 08:16:00 +02:00
foreign Improve ExplainState type handling in header files 2025-09-15 11:04:10 +02:00
jit Don't use double-quotes in #include's of system headers, redux. 2025-04-27 13:23:19 -04:00
lib Use PRI?64 instead of "ll?" in format strings (continued). 2025-03-29 10:43:57 +01:00
libpq Remove hbaPort type 2025-09-15 11:04:10 +02:00
mb With GB18030, prevent SIGSEGV from reading past end of allocation. 2025-05-05 04:52:04 -07:00
nodes Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
optimizer Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
parser Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
partitioning Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
pch meson: Increase minimum version to 0.57.2 2025-07-02 11:14:53 +02:00
port Remove traces of support for Sun Studio compiler 2025-09-12 07:39:05 +02:00
portability Update copyright for 2025 2025-01-01 11:21:55 -05:00
postmaster Fix incorrect const qualifier 2025-09-16 07:27:32 +02:00
regex Update copyright for 2025 2025-01-01 11:21:55 -05:00
replication Allow redeclaration of typedef yyscan_t 2025-09-12 08:16:00 +02:00
rewrite Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
snowball Update to latest Snowball sources. 2025-02-18 21:13:54 -05:00
statistics Stats: use schemaname/relname instead of regclass. 2025-03-25 11:16:06 -07:00
storage Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
tcop Update various forward declarations to use typedef 2025-09-15 11:04:10 +02:00
tsearch Update copyright for 2025 2025-01-01 11:21:55 -05:00
utils Change fmgr.h typedefs to use original names 2025-09-15 11:04:10 +02:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h Remove traces of support for Sun Studio compiler 2025-09-12 07:39:05 +02:00
fmgr.h Change fmgr.h typedefs to use original names 2025-09-15 11:04:10 +02:00
funcapi.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
getopt_long.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
Makefile Clean up newly added guc_tables.inc.c 2025-09-04 17:25:43 +02:00
meson.build meson: add and use stamp files for generated headers 2025-08-11 15:18:23 -04:00
miscadmin.h Revert function to get memory context stats for processes 2025-05-23 15:44:54 +02:00
pg_config.h.in aio: Combine io_uring memory mappings, if supported 2025-07-07 22:57:07 -04:00
pg_config_manual.h Make type Datum be 8 bytes wide everywhere. 2025-08-13 17:18:22 -04:00
pg_getopt.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pg_trace.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
pgstat.h Generate pgstat_count_slru*() functions for slru using macros 2025-09-02 16:22:03 +09:00
pgtar.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pgtime.h Seek zone abbreviations in the IANA data before timezone_abbreviations. 2025-01-16 14:11:19 -05:00
port.h Add timingsafe_bcmp(), for constant-time memory comparison 2025-04-02 15:32:40 +03:00
postgres.h Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true. 2025-08-13 17:18:22 -04:00
postgres_ext.h Move pg_int64 back to postgres_ext.h 2025-09-16 10:48:56 +02:00
postgres_fe.h IWYU widely useful pragmas 2025-01-15 18:57:53 +01:00
varatt.h Convert varatt.h access macros to static inline functions. 2025-08-05 17:01:25 +02:00
windowapi.h Update copyright for 2025 2025-01-01 11:21:55 -05:00