Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita3699da

Browse files
committed
libpq: Improve error message when parsing URI parameters and keywords
The error message showing up when parameters or keywords include toomany whitespaces was "trailing data found", which was confusing becausethere was no hint about what was actually wrong.Issue introduced in430ce18, hence there is no need for abackpatch.Author: Yushi OgiwaraReviewed-by: Fujii Masao, Tom Lane, Bruce MomjianDiscussion:https://postgr.es/m/645bd22a53c4da8a1bc7e1e52d9d3b52@oss.nttdata.com
1 parentb38bac2 commita3699da

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6825,7 +6825,9 @@ conninfo_uri_decode(const char *str, PQExpBuffer errorMessage)
68256825
/* Not at the end of the string yet? Fail. */
68266826
if (*q!='\0')
68276827
{
6828-
libpq_append_error(errorMessage,"trailing data found: \"%s\"",str);
6828+
libpq_append_error(errorMessage,
6829+
"unexpected spaces found in \"%s\", use percent-encoded spaces (%%20) instead",
6830+
str);
68296831
free(buf);
68306832
returnNULL;
68316833
}

‎src/interfaces/libpq/t/001_uri.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@
9696
# Trailing data in parameter.
9797
q{postgresql://host? user user = uri & port = 12345 12},
9898
q{},
99-
q{libpq_uri_regress:trailing data found:" user user "},
99+
q{libpq_uri_regress:unexpected spaces found in" user user ", use percent-encoded spaces (%20) instead},
100100
],
101101
[
102102
# Trailing data in value.
103103
q{postgresql://host? user = uri-user & port = 12345 12},
104104
q{},
105-
q{libpq_uri_regress:trailing data found:" 12345 12 "},
105+
q{libpq_uri_regress:unexpected spaces found in" 12345 12 ", use percent-encoded spaces (%20) instead},
106106
],
107107
[q{postgresql://host?},q{host='host' (inet)},q{}, ],
108108
[

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp