Skip to content

Commit 3b5548a

Browse files
committed
When using libpq URI syntax, error out on invalid parameter names.
Dan Farina
1 parent f1438cf commit 3b5548a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4874,9 +4874,11 @@ conninfo_uri_parse_params(char *params,
48744874
return false;
48754875
}
48764876

4877-
fprintf(stderr,
4878-
libpq_gettext("WARNING: ignoring unrecognized URI query parameter: %s\n"),
4879-
keyword);
4877+
printfPQExpBuffer(errorMessage,
4878+
libpq_gettext(
4879+
"invalid URI query parameter \"%s\"\n"),
4880+
keyword);
4881+
return false;
48804882
}
48814883
if (malloced)
48824884
{

src/interfaces/libpq/test/expected.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ trying postgresql://host/db?u%73er=someotheruser&port=12345
5959
user='someotheruser' dbname='db' host='host' port='12345' (inet)
6060

6161
trying postgresql://host/db?u%7aer=someotheruser&port=12345
62-
WARNING: ignoring unrecognized URI query parameter: uzer
63-
dbname='db' host='host' port='12345' (inet)
62+
uri-regress: invalid URI query parameter "uzer"
63+
6464

6565
trying postgresql://host:12345?user=uri-user
6666
user='uri-user' host='host' port='12345' (inet)
@@ -102,8 +102,8 @@ trying postgres://?host=/path/to/socket/dir
102102
host='/path/to/socket/dir' (local)
103103

104104
trying postgresql://host?uzer=
105-
WARNING: ignoring unrecognized URI query parameter: uzer
106-
host='host' (inet)
105+
uri-regress: invalid URI query parameter "uzer"
106+
107107

108108
trying postgre://
109109
uri-regress: missing "=" after "postgre://" in connection info string

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy