Re: Lost search_path after transaction fails

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: David Newall <postgresql(at)davidnewall(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Lost search_path after transaction fails
Date: 2009-02-14 08:45:46
Message-ID: 499684BA.8050307@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Newall wrote:
> The session search_path is lost after a failed transaction, using SQL
> embedded in C, pre-processed by ecpg without -t. I'm running Postgresql
> 8.2.11, as packaged by Ubuntu for Ubuntu 7.10 (8.2.11-0ubuntu0.7.10).
> Kernel is 2.6.25.13.

ecpg implicitly runs everything inside transactions. You don't need to
run START TRANSACTION, that's implicit. Therefore the "set search_path"
command is in fact run in the same transaction as the failing insert, as
also hinted by the warning "there is already a transaction in progress"
at the START TRANSACTION command.

You could use -t, or add a COMMIT after the "set search_path".

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tyler Ware 2009-02-14 14:27:41 BUG #4654: not accepting password for user
Previous Message David Newall 2009-02-14 02:17:38 Lost search_path after transaction fails