pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7635: psql -1 and \connect
3+ messages / 3 participants
[nested] [flat]

* BUG #7635: psql -1 and \connect
@ 2012-11-01 13:12 pgmail@joh.to
  2012-11-01 21:29 ` Re: BUG #7635: psql -1 and \connect Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: pgmail@joh.to @ 2012-11-01 13:12 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7635
Logged by:          Marko Tiikkaja
Email address:      pgmail@joh.to
PostgreSQL version: 9.1.6
Operating system:   OSX something
Description:        

Hi,

With a simple script like this:

\connect postgres
CREATE TABLE foo();
ERROR_HERE;

You get output like this:

You are now connected to database "postgres" as user "postgres".
CREATE TABLE
psql:singletxn.sql:3: ERROR:  syntax error at or near "ERROR_HERE"
LINE 1: ERROR_HERE;
        ^
psql:singletxn.sql:0: WARNING:  there is no transaction in progress

Which isn't really what I expected :-(

I know it's not clear what to do with --single-transaction if a script is
\connecting to multiple databases in a single file, but IMHO it should at
least work correctly for the single database case.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7635: psql -1 and \connect
  2012-11-01 13:12 BUG #7635: psql -1 and \connect pgmail@joh.to
@ 2012-11-01 21:29 ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-11-01 22:05   ` Re: BUG #7635: psql -1 and \connect Marko Tiikkaja <pgmail@joh.to>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2012-11-01 21:29 UTC (permalink / raw)
  To: pgmail@joh.to; +Cc: pgsql-bugs

pgmail@joh.to writes:
> I know it's not clear what to do with --single-transaction if a script is
> \connecting to multiple databases in a single file, but IMHO it should at
> least work correctly for the single database case.

Define "correctly" --- I would expect \connect to establish a new
connection even if the same target database is named.  We can't change
that behavior without breaking existing scripts, IMO --- for example, \c
is a long-established way to reset GUC settings, prepared statements,
etc.

Perhaps we should have \connect fail outright in -1 mode.  I can see
no way for it to do anything and still maintain the expectation of a
single transaction.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7635: psql -1 and \connect
  2012-11-01 13:12 BUG #7635: psql -1 and \connect pgmail@joh.to
  2012-11-01 21:29 ` Re: BUG #7635: psql -1 and \connect Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-11-01 22:05   ` Marko Tiikkaja <pgmail@joh.to>
  0 siblings, 0 replies; 3+ messages in thread

From: Marko Tiikkaja @ 2012-11-01 22:05 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

On Thu, 01 Nov 2012 22:29:50 +0100, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> pgmail@joh.to writes:
>> I know it's not clear what to do with --single-transaction if a script  
>> is
>> \connecting to multiple databases in a single file, but IMHO it should  
>> at
>> least work correctly for the single database case.
>
> Define "correctly" --- I would expect \connect to establish a new
> connection even if the same target database is named.  We can't change
> that behavior without breaking existing scripts, IMO --- for example, \c
> is a long-established way to reset GUC settings, prepared statements,
> etc.

Hmm..  I only considered the case where the \connect is at the beginning  
of the file.  I see your point.

> Perhaps we should have \connect fail outright in -1 mode.  I can see
> no way for it to do anything and still maintain the expectation of a
> single transaction.

Would supporting a \connect at the very beginning of the file seem  
possible?  Maybe even only if it's to the same database?


Regards,
Marko Tiikkaja




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-11-01 22:05 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 13:12 BUG #7635: psql -1 and \connect pgmail@joh.to
2012-11-01 21:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-11-01 22:05   ` Marko Tiikkaja <pgmail@joh.to>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox