Re: Connection without database name - Mailing list pgsql-hackers

From Michael Fuhr
Subject Re: Connection without database name
Date
Msg-id 20041223160300.GA55796@winnie.fuhr.org
Whole thread Raw
In response to Connection without database name  (Michael Meskes <meskes@postgresql.org>)
List pgsql-hackers
On Thu, Dec 23, 2004 at 10:46:26AM +0100, Michael Meskes wrote:

> Very early in its existance ecpg got an oracle compat hack that enabled
> it to do a connect with just the username and use the database as
> specified via PGDATABASE. It appears that this feature is not really
> used as it seems it segfault for quite some amount of releases. 

The following works for me in 8.0.0rc2 and 7.4.6, making the
connection based on PGDATABASE, PGUSER, etc.:
 EXEC SQL BEGIN DECLARE SECTION; char  *target = ""; EXEC SQL END DECLARE SECTION;
 EXEC SQL CONNECT TO :target;

The following, however, dumps core with a segmentation fault:
 EXEC SQL CONNECT TO DEFAULT;

Here's a backtrace from 8.0.0rc2:

#0  0x280d5dcc in strdup () from /usr/lib/libc.so.4
#1  0x2806efac in ECPGconnect (lineno=17, c=0, name=0x0, user=0x0, passwd=0x0,    connection_name=0x8048800 "DEFAULT",
autocommit=0)at connect.c:245
 
#2  0x804864e in main () at conntest.pgc:17

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: join selectivity
Next
From: Tom Lane
Date:
Subject: Re: Bgwriter behavior