Skip site navigation (1) Skip section navigation (2)

Re: minor issue with psql keeping connections

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: minor issue with psql keeping connections
Date: 2004-10-31 15:29:36
Message-ID: 200410311029.36319.xzilla@users.sourceforge.net (view raw or flat)
Thread:
Lists: pgsql-bugs
On Sunday 31 October 2004 10:16, Robert Treat wrote:
> pgsql running on port 5480, connect to t\echo :PORTemplate1 as non-superuser
> "phppgadmin" who does not have createdb privileges. attempt to run a script
> that creates a database "phppgadmin" and then do a \connect to that
> database.   this fails (as it should) but when it does, it loses the
> connection to template1, and i am not able to reconnect to any database, i
> think because it is looking on port 5432 rather than the 5480 i specified
> when i originally connected.
>
> postgres(at)phppgadmin:/usr/local/pgsql-8.0.0beta-4/bin$ ./psql -p5480
> template1 -U phppgadmin
> Welcome to psql 8.0.0beta4, the PostgreSQL interactive terminal.
>
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help with psql commands
>        \g or terminate with semicolon to execute query
>        \q to quit
>
> template1=> select version();
>                               version
> --------------------------------------------------------------------
>  PostgreSQL 8.0.0beta4 on i586-pc-linux-gnu, compiled by GCC 2.95.3
> (1 row)
>
> template1=> \i
> /usr/local/apache/htdocs/phppgadmin3cvs/sql/reports-pgsql.sql ERROR: 
> permission denied to create database
> psql:/usr/local/apache/htdocs/phppgadmin3cvs/sql/reports-pgsql.sql:7:
> ERROR: permission denied to create database
> FATAL:  database "phppgadmin" does not exist
> psql:/usr/local/apache/htdocs/phppgadmin3cvs/sql/reports-pgsql.sql:9:
> \connect: FATAL:  database "phppgadmin" does not exist
> !> \c template1
> could not connect to server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> !>
> !>
>
> relativily minor issue, but seems like it should either be able to retain
> the connection when inside the script, or recall that it needs to connect
> on 5480 after failure.

little addition... the variable :PORT is unsert after the script bombs. psql 
assumes that it should be connecting on 5432 rather than what would normally 
be aqailable in :PORT and so it will reconnect if you are on a standard port. 

-- 
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

In response to

pgsql-bugs by date

Next:From: Ralph HeinkelDate: 2004-10-31 15:37:26
Subject: possible bug using combination of 'serial' and rule
Previous:From: Robert TreatDate: 2004-10-31 15:16:08
Subject: minor issue with psql keeping connections

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group