diff options
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 3bf27da4278..75bcb43433b 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.239 2003/04/28 04:52:13 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.240 2003/05/05 00:44:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -376,6 +376,17 @@ static bool connectOptions2(PGconn *conn) { /* + * If database name was not given, default it to equal user name + */ + if ((conn->dbName == NULL || conn->dbName[0] == '\0') + && conn->pguser != NULL) + { + if (conn->dbName) + free(conn->dbName); + conn->dbName = strdup(conn->pguser); + } + + /* * Supply default password if none given */ if (conn->pgpass == NULL || conn->pgpass[0] == '\0') |