pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alex <cdalxndr@yahoo.com>
To: Dave Cramer <davecramer@gmail.com>
Cc: PG Bug reporting form <noreply@postgresql.org>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16028: JDBC currentSchema connection parameter not working for text search configuration
Date: Mon, 30 Sep 2019 11:37:37 +0000 (UTC)
Message-ID: <288920436.1347006.1569843457296@mail.yahoo.com> (raw)
In-Reply-To: <CADK3HH+ri_c6M9AfGY0D_BNBNgxtBFTqgohuRhuhL_xYR2R15g@mail.gmail.com>
References: <16028-3b4724da97a51b77@postgresql.org>
	<CADK3HHKyHK0PU=BHMM2R4-Z1NUMoMxUEFHK_Dc+07kVubhJwFA@mail.gmail.com>
	<2007560436.1326832.1569838383795@mail.yahoo.com>
	<CADK3HH+ri_c6M9AfGY0D_BNBNgxtBFTqgohuRhuhL_xYR2R15g@mail.gmail.com>

 What's the behavior when both "currentSchema" is specified in the connection uri and "search_path" is overwritten to a different value by the app (inside the same transaction as the query)?Neither https://jdbc.postgresql.org/documentation/head/connect.html, nor https://www.postgresql.org/docs/9.1/runtime-config-client.html mention the behavior.





    On Monday, September 30, 2019, 1:56:38 PM GMT+3, Dave Cramer <davecramer@gmail.com> wrote:  
 
 Alex,


On Mon, 30 Sep 2019 at 06:13, Alex <cdalxndr@yahoo.com> wrote:

 Additional info:The original schema was exported using pg_dump (whole db) and imported using "psql -f". 
Then I've renamed the schema in PgAdmin(4.13) to "dev" (right click -> Properties -> change name -> Save).
If I rename back the schema to original name, and use that name in "currentSchema" param, then everything works correctly.
In addition, I don't know if any configuration may override the connection param "currentSchema" (such as hibernate overwriting "search_path"), but in my case it should be used as fallback to resolve missing text search configuration.


Seems something else is going on then as this code:
@Test
public void testSchemaInProperties() throws Exception {
  Connection con = java.sql.DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/test?currentSchema=dev,public","test","");

  Statement stmt = con.createStatement();
  stmt.execute("SHOW search_path");

  ResultSet rs = stmt.getResultSet();
  if (!rs.next()) {
    Assert.fail("'options' connection initialization parameter should be passed to the database.");
  }
  Assert.assertEquals("'options' connection initialization parameter should be passed to the database.", "dev,public", rs.getString(1));

  stmt.close();
  TestUtil.closeDB(con);
}
works fine.
Dave.  


    On Monday, September 30, 2019, 3:45:48 AM GMT+3, Dave Cramer <davecramer@gmail.com> wrote:  
 
 Interesting,
Thanks for the report.
Dave Cramer

On Thu, 26 Sep 2019 at 18:16, PG Bug reporting form <noreply@postgresql.org> wrote:

The following bug has been logged on the website:

Bug reference:      16028
Logged by:          cd a
Email address:      cdalxndr@yahoo.com
PostgreSQL version: 10.3
Operating system:   Windows 10
Description:        

Using a java spring app with connection:
jdbc:postgresql://localhost:5433/postgres?currentSchema=dev,public&ApplicationName=myapp
Schema 'dev' has fts configuration 'en'.
Query (debugged PgPreparedStatement):
  select * from dev.category where category.language='en'
  the param 'en' is registered with oid (paramType) 3734 corresponding to
'regconfig' type

Query results in: ERROR: text search configuration "en" does not exist

The same error is shown when running the query in PgAdmin if search_path
doesn't contain 'dev' schema. With 'dev' in search_path, the query is ok.
I was expecting that 'currentSchema' connection parameter will be used to
resolve fts configuration to 'dev' schema.


  
  

view thread (8+ messages)  latest in thread

Message-ID: <288920436.1347006.1569843457296@mail.yahoo.com>
Permalink:  ../288920436.1347006.1569843457296@mail.yahoo.com/
Also on:    postgresql.org/message-id/288920436.1347006.1569843457296@mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: cdalxndr@yahoo.com, davecramer@gmail.com, noreply@postgresql.org
  Subject: Re: BUG #16028: JDBC currentSchema connection parameter not working for text search configuration
  In-Reply-To: <288920436.1347006.1569843457296@mail.yahoo.com>
  References: <16028-3b4724da97a51b77@postgresql.org> <CADK3HHKyHK0PU=BHMM2R4-Z1NUMoMxUEFHK_Dc+07kVubhJwFA@mail.gmail.com> <2007560436.1326832.1569838383795@mail.yahoo.com> <CADK3HH+ri_c6M9AfGY0D_BNBNgxtBFTqgohuRhuhL_xYR2R15g@mail.gmail.com> <288920436.1347006.1569843457296@mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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