When using libpq URI syntax, error out on invalid parameter names.
authorRobert Haas <rhaas@postgresql.org>
Fri, 8 Jun 2012 12:46:39 +0000 (08:46 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 8 Jun 2012 12:47:24 +0000 (08:47 -0400)
Dan Farina

src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/test/expected.out

index 960811f233e26756d09d3c2b84165db3d8d0472d..33daaec7be47ab6113ad4de295a4292f9c84290f 100644 (file)
@@ -4874,9 +4874,11 @@ conninfo_uri_parse_params(char *params,
                                return false;
                        }
 
-                       fprintf(stderr,
-                                       libpq_gettext("WARNING: ignoring unrecognized URI query parameter: %s\n"),
-                                       keyword);
+                       printfPQExpBuffer(errorMessage,
+                                                         libpq_gettext(
+                                                                 "invalid URI query parameter \"%s\"\n"),
+                                                         keyword);
+                       return false;
                }
                if (malloced)
                {
index 6d5077d7623d26ddbf2bea5366f548d2a38a031e..cc22a96890a30466ea3b8e577e5405c878a70e54 100644 (file)
@@ -59,8 +59,8 @@ trying postgresql://host/db?u%73er=someotheruser&port=12345
 user='someotheruser' dbname='db' host='host' port='12345' (inet)
 
 trying postgresql://host/db?u%7aer=someotheruser&port=12345
-WARNING: ignoring unrecognized URI query parameter: uzer
-dbname='db' host='host' port='12345' (inet)
+uri-regress: invalid URI query parameter "uzer"
+
 
 trying postgresql://host:12345?user=uri-user
 user='uri-user' host='host' port='12345' (inet)
@@ -102,8 +102,8 @@ trying postgres://?host=/path/to/socket/dir
 host='/path/to/socket/dir' (local)
 
 trying postgresql://host?uzer=
-WARNING: ignoring unrecognized URI query parameter: uzer
-host='host' (inet)
+uri-regress: invalid URI query parameter "uzer"
+
 
 trying postgre://
 uri-regress: missing "=" after "postgre://" in connection info string