Inconsistent "Set Local search_path" behavior in JDBC

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Inconsistent "Set Local search_path" behavior in JDBC
Date: 2011-05-26 20:42:46
Message-ID: 000301cc1be5$789a9880$69cfc980$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

While doing some test development I observed the following behavior when
using SET LOCAL search_path TO . within a adhoc (BEGIN . COMMIT)
transaction.

I am working with a multiple schema database using 9.0.3 in Windows 7 64-bit
/ 9.0.801 driver

I had previously issued:

SET DATABASE search_path TO public, domain;

I then issue:

BEGIN;

SET LOCAL search_path = process, domain; [note that process is not on the
database search path]

CREATE TABLE t .

COMMIT;

At which point the table appears in the process domain.

I then issue:

BEGIN;

SET LOCAL search_path = process, domain;

INSERT INTO t (.) VALUES (.);

COMMIT;

And I get an exception that:

"relation "t" does not exist"

If I then go back and issue:

SET DATABASE search_path TO public, domain, process; [adding process to the
database search path]

I am able to successfully run the INSERT INTO transaction.

If I run the same commands (the INSERT INTO transaction) in my GUI
environment (PostgreSQL Maestro) it does not matter whether the DATABASE
search_path includes "process". It, for some reason, also does not seem to
matter when issuing the "CREATE TABLE" transaction within JDBC.

David J.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Simon Mitchell 2011-05-30 12:39:38 PreparedStatement error for date parameter with overlaps
Previous Message Craig Ringer 2011-05-25 01:39:57 Re: Support for cert auth in JDBC