On tor, 2009-11-26 at 10:57 +0200, Peter Eisentraut wrote: > When using the "service" parameter in a libpq connection (e.g., psql > service=foo), and the service name is not defined in pg_service.conf, > then the setting is silently ignored and the connection proceeds with > whatever other settings and defaults apply. That does not look very > robust. Shouldn't there be an error when a specified service name does > not exist?
Possible patch for this issue.
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 011ebab..b322f8d 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -3189,6 +3189,13 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) fclose(f); } + if (!group_found) + { + printfPQExpBuffer(errorMessage, + libpq_gettext("ERROR: service \"%s\" not found\n"), service); + return 3; + } + return 0; }
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers