When "psql -l" is invoked from prompt and not completed, no other user can create a database..

Started by Adrian Calvinover 22 years ago6 messagesbugs
Jump to latest
#1Adrian Calvin
acexec@yahoo.com

Postgres Version 7.1

When "psql -l" is invoked from prompt, and a user lets it sit at the 'more' prompt, no other user can create a database. The "cannot access template..." error is thrown. Has this been corrected in later versions?

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

#2Bruce Momjian
bruce@momjian.us
In reply to: Adrian Calvin (#1)
Re: When "psql -l" is invoked from prompt and not completed,

Adrian Calvin wrote:

Postgres Version 7.1

When "psql -l" is invoked from prompt, and a user lets it sit
at the 'more' prompt, no other user can create a database. The
"cannot access template..." error is thrown. Has this been
corrected in later versions?

Sorry, I have trouble believing that. What version of PostgreSQL are
you using.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: When "psql -l" is invoked from prompt and not completed,

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Adrian Calvin wrote:

When "psql -l" is invoked from prompt, and a user lets it sit
at the 'more' prompt, no other user can create a database. The
"cannot access template..." error is thrown. Has this been
corrected in later versions?

Sorry, I have trouble believing that.

I don't. It's from the interlock that prevents copying a database that
contains active sessions.

regards, tom lane

#4Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#3)
Re: When "psql -l" is invoked from prompt and not completed,

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Adrian Calvin wrote:

When "psql -l" is invoked from prompt, and a user lets it sit
at the 'more' prompt, no other user can create a database. The
"cannot access template..." error is thrown. Has this been
corrected in later versions?

Sorry, I have trouble believing that.

I don't. It's from the interlock that prevents copying a database that
contains active sessions.

I understand that, but why does psql still hold that lock while
displaying the database names with more? I thought the database was
shipped to the client, and the locks released.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#4)
Re: When "psql -l" is invoked from prompt and not completed,

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Tom Lane wrote:

I don't. It's from the interlock that prevents copying a database that
contains active sessions.

I understand that, but why does psql still hold that lock while
displaying the database names with more?

I don't think it closes the database connection until it's ready to
exit.

We could maybe fix -l to close the connection before outputting data,
but it doesn't seem like that really will make a lot of difference.
What of someone who's connected to template1 with a plain "psql
template1" session?

regards, tom lane

#6Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#5)
Re: When "psql -l" is invoked from prompt and not completed,

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Tom Lane wrote:

I don't. It's from the interlock that prevents copying a database that
contains active sessions.

I understand that, but why does psql still hold that lock while
displaying the database names with more?

I don't think it closes the database connection until it's ready to
exit.

We could maybe fix -l to close the connection before outputting data,
but it doesn't seem like that really will make a lot of difference.
What of someone who's connected to template1 with a plain "psql
template1" session?

Oh, so it is their connection to template1 that is causing the lock, not
the display of the -l data. Thanks, got it, and makes sense.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073