Skip to content

Commit d5515ca

Browse files
committed
Reject missing database name in pg_regress and cohorts.
Writing "pg_regress --dbname= ..." led to a crash, because we weren't expecting there to be no database name supplied. It doesn't seem like a great idea to run regression tests in whatever is the user's default database; so rather than supporting this case let's explicitly reject it. Per report from Xing Guo. Back-patch to all supported branches. Discussion: https://postgr.es/m/CACpMh+A8cRvtvtOWVAZsCM1DU81GK4DL26R83y6ugZ1osV=ifA@mail.gmail.com
1 parent 8f2e74b commit d5515ca

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test/regress/pg_regress.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,6 +2182,17 @@ regression_main(int argc, char *argv[],
21822182
optind++;
21832183
}
21842184

2185+
/*
2186+
* We must have a database to run the tests in; either a default name, or
2187+
* one supplied by the --dbname switch.
2188+
*/
2189+
if (!(dblist && dblist->str && dblist->str[0]))
2190+
{
2191+
fprintf(stderr, _("%s: no database name was specified\n"),
2192+
progname);
2193+
exit(2);
2194+
}
2195+
21852196
if (config_auth_datadir)
21862197
{
21872198
#ifdef ENABLE_SSPI

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