Re: Connection gets into state where all queries fail

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Connection gets into state where all queries fail
Дата
Msg-id 20040622224134.GD27296@svana.org
обсуждение исходный текст
Ответ на Re: Connection gets into state where all queries fail  (Scott Ribe <scott_ribe@killerbytes.com>)
Ответы Re: Connection gets into state where all queries fail  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Connection gets into state where all queries fail  (Scott Ribe <scott_ribe@killerbytes.com>)
Список pgsql-general
On Tue, Jun 22, 2004 at 04:30:15PM -0600, Scott Ribe wrote:
> > All your queries will be ignored until you complete the transaction,
> > either with a commit or a rollback. I find the message very clear, how
> > do you think it could be reworded to be more clear?
>
> What's not clear is why I should be told this when the invalid query ended
> with a commit.

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

> > In your program, yes. Although I find it interesting that your commit
> > is ignored after the error. Just send it as a seperate query.
>
> Yes, exactly. I've never seen a commit be ignored like this--believe me I've
> had other erroneous queries, and the connections never got borked like this.

Will, it's definitly repeatable:

$ perl -MPg -e '$db = Pg::connectdb("dbname=kleptog");
$db->exec("begin; select error; commit;");
$db->exec("select 1");
print $db->errorMessage;'
ERROR:  current transaction is aborted, queries ignored until end of
transaction block

> I'll certainly add such code as a fail-safe, but I'd still like to
> understand more fully what has happened. Can I really be 100% sure this
> would keep the connection usable, given that the 1 commit already somehow
> failed to end the transaction block? I can certainly understand that a
> commit submitted by itself might be recognized where for some reason the
> original one was skipped over, but I'd still like to know more about what
> happened.

If you send each query in a seperate request, it'll work. I don't know
if the current behaviour is really a bug...

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Ribe
Дата:
Сообщение: Re: Connection gets into state where all queries fail
Следующее
От: Tom Lane
Дата:
Сообщение: Re: flock user defined function