Re: Connection gets into state where all queries fail

From: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Connection gets into state where all queries fail
Date: 2004-06-23 01:02:28
Message-ID: BCFE32C4.4A5B8%scott_ribe@killerbytes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From Martijn van Oosterhout:

> Hmm, it only happens when you send the whole lot in a single query
> strings. That's not recommended IIRC.

And from Tom Lane:

> When you send multiple commands in a single query string, the entire
> string is thrown away after an error. That's how it's always worked,
> and I believe it's well-documented. There are apps that (mis?)use this
> fact.

OK, so I think I understand now. I'd earlier seen errors in multi-statement
strings and this problem didn't happen. But those errors were with
constraints that were deferred, so the error wasn't generated until the
commit was being processed, so the transaction block was terminated. While
this error (string too long for varchar column) happens as soon as the
insert is handled and the commit is never seen.

And as for:

> Will, it's definitly repeatable:

I suppose psql sends either a commit or rollback after the query generates
the error, maybe after every query, so my attempt to use it to check this
wasn't a valid test.

Thanks for the help.

--
Scott Ribe
scott_ribe(at)killerbytes(dot)com
http://www.killerbytes.com/
(303) 665-7007 voice

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Bartley 2004-06-23 01:23:04 Re: Deleting all but one row of a list of non-uniques
Previous Message Martijn van Oosterhout 2004-06-23 00:41:38 Re: Deleting all but one row of a list of non-uniques