summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-11-19 13:27:42 +0900
committerMichael Paquier <michael@paquier.xyz>2024-11-19 13:27:42 +0900
commita3699daea2026de324ed7cc7115c36d3499010d3 (patch)
treee1105759dc1acd07da476ea7257a711f9d8ce7d6 /src/interfaces/libpq/fe-connect.c
parentb38bac26e203ffb4130a6e0f27146cb8d4bbc9c0 (diff)
libpq: Improve error message when parsing URI parameters and keywords
The error message showing up when parameters or keywords include too many whitespaces was "trailing data found", which was confusing because there was no hint about what was actually wrong. Issue introduced in 430ce189fc45, hence there is no need for a backpatch. Author: Yushi Ogiwara Reviewed-by: Fujii Masao, Tom Lane, Bruce Momjian Discussion: https://postgr.es/m/645bd22a53c4da8a1bc7e1e52d9d3b52@oss.nttdata.com
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 51083dcfd8e..aaf87e8e885 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -6825,7 +6825,9 @@ end:
/* Not at the end of the string yet? Fail. */
if (*q != '\0')
{
- libpq_append_error(errorMessage, "trailing data found: \"%s\"", str);
+ libpq_append_error(errorMessage,
+ "unexpected spaces found in \"%s\", use percent-encoded spaces (%%20) instead",
+ str);
free(buf);
return NULL;
}