Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEuky-0006HJ-PL for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Sep 2019 12:26:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iEukw-0007w5-IW for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Sep 2019 12:26:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEukw-0007vR-97 for pgsql-bugs@lists.postgresql.org; Mon, 30 Sep 2019 12:26:22 +0000 Received: from sonic305-21.consmr.mail.ne1.yahoo.com ([66.163.185.147]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEukn-0002hh-A1 for pgsql-bugs@lists.postgresql.org; Mon, 30 Sep 2019 12:26:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1569846370; bh=lDTIYWZhGzgDj2/H6shDD+KqD5fwFVurMm7yLqx12aE=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=RMJGckmb7wsF/RyPTBgIxl/gI2N9tT9MdW3L+3ABuhs2MH6rsD3a56XZ5YleG5IaklMHrvlvHXxBGlMXeWgOpdFJ95lX8uMN1u0ycVHK6bN00/zRKdoBVpUZzACuRPE+dt495bl+QhhBFJFY1RTeQpixDmqMNZIsoojN5E+yiPo13tbu4KOXpSXph7hdzSbivE7F2beYQmfP8Eg4STR1TaC4AnyLRgFaHLm6vsWZ5ClhPHq/dP0wrms10tYzcTzR7iPRiFlCAO1F38mzq5GTdYEuI9t8xvfJuaSjnABmaHXtVJQ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euc6FGDreCmycsnO06mOKzHKYj5iIf 4u0FxbfhbuyfMAMSBCvwTA4b4KuoTFAE1gI_qSSKK_GzOtsB8ufru2ve86D_rTxraenl1Y1AcsWG C9jsnalk5CPcnUkjTwPm1EamOtN2ZDuPlf8O6STrW3QWeAF0FyX3rKsuID5F1OuBerEGn7Kjxycw sDkPoRCpZrTzYn3GA7kTJTD8W6odMzyCxIbJDsEUt26_sxU_y4hUNUyopzcQBESTwljod9uTBJOC YnLr.qzkgqz1RPMucTRSo74QVpuTCbc07sqDSz1bRQ1uOT4JztAg8nT5hdsaYxgHGDwXulfJ2BCm VXg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Mon, 30 Sep 2019 12:26:10 +0000 Date: Mon, 30 Sep 2019 12:24:23 +0000 (UTC) From: Alex To: Dave Cramer Cc: PG Bug reporting form , pgsql-bugs@lists.postgresql.org Message-ID: <960870528.1336168.1569846263408@mail.yahoo.com> In-Reply-To: References: <16028-3b4724da97a51b77@postgresql.org> <2007560436.1326832.1569838383795@mail.yahoo.com> <288920436.1347006.1569843457296@mail.yahoo.com> Subject: Re: BUG #16028: JDBC currentSchema connection parameter not working for text search configuration MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1336167_1256003967.1569846263405" X-Mailer: WebService/1.1.14448 YMailNorrin Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0 Content-Length: 16262 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_1336167_1256003967.1569846263405 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable After more debugging, it seems that the "search_path" is set to the old sc= hema causing the error ( entityManager.createNativeQuery( "show search_path= " ).getResultList() returns different schema).Initially I've thought that t= he connection param "currentSchema" will be used as fallback even if "searc= h_path" is invalid. I've set the necessary configuration params to the new schema, but somehow = it remains set to an old value. Need to do more debugging. This issue can be closed as this is not a postgres issue. On Monday, September 30, 2019, 2:47:13 PM GMT+3, Dave Cramer wrote: =20 =20 =20 On Mon, 30 Sep 2019 at 07:37, Alex wrote: What's the behavior when both "currentSchema" is specified in the connecti= on uri and "search_path" is overwritten to a different value by the app (in= side the same transaction as the query)?Neither https://jdbc.postgresql.org= /documentation/head/connect.html, nor https://www.postgresql.org/docs/9.1/r= untime-config-client.html mention the behavior. Initially the driver will set the search_path to whatever is in the "curren= tSchema"The driver doesn't do anything special if you change the search_pat= h in a transaction, however: The search_path setting will be set to whatever it was set to in the transa= ction if you commit. If you rollback it will rollback the setting. Dave=C2=A0 On Monday, September 30, 2019, 1:56:38 PM GMT+3, Dave Cramer wrote: =20 =20 Alex, On Mon, 30 Sep 2019 at 06:13, Alex wrote: Additional info:The original schema was exported using pg_dump (whole db) = and imported using "psql -f".=20 Then I've renamed the schema in PgAdmin(4.13) to "dev" (right click -> Prop= erties -> change name -> Save). If I rename back the schema to original name, and use that name in "current= Schema" 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 confi= guration. Seems something else is going on then as this code: @Test public void testSchemaInProperties() throws Exception { Connection con =3D java.sql.DriverManager.getConnection("jdbc:postgresql:= //127.0.0.1:5432/test?currentSchema=3Ddev,public","test",""); Statement stmt =3D con.createStatement(); stmt.execute("SHOW search_path"); ResultSet rs =3D stmt.getResultSet(); if (!rs.next()) { Assert.fail("'options' connection initialization parameter should be pa= ssed 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.=C2=A0=C2=A0 On Monday, September 30, 2019, 3:45:48 AM GMT+3, Dave Cramer wrote: =20 =20 Interesting, Thanks for the report. Dave Cramer On Thu, 26 Sep 2019 at 18:16, PG Bug reporting form wrote: The following bug has been logged on the website: Bug reference:=C2=A0 =C2=A0 =C2=A0 16028 Logged by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cd a Email address:=C2=A0 =C2=A0 =C2=A0 cdalxndr@yahoo.com PostgreSQL version: 10.3 Operating system:=C2=A0 =C2=A0Windows 10 Description:=C2=A0 =C2=A0 =C2=A0 =C2=A0=20 Using a java spring app with connection: jdbc:postgresql://localhost:5433/postgres?currentSchema=3Ddev,public&Applic= ationName=3Dmyapp Schema 'dev' has fts configuration 'en'. Query (debugged PgPreparedStatement): =C2=A0 select * from dev.category where category.language=3D'en' =C2=A0 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. =20 =20 =20 ------=_Part_1336167_1256003967.1569846263405 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
After more debugging, it seems that the "search_path" is set to = the old schema causing the error ( entityManager.createNativeQuery( "= show search_path" ).getResultList() returns different schema).
=
Initially I've thought that th= e connection param "currentSchema" will be used as fallback even if "= search_path" is invalid.

I= 've set the necessary configuration params to the new schema, but somehow i= t remains set to an old value. Need to do more debugging.
This issue can be closed as this is not a po= stgres issue.

=20
=20
On Monday, September 30, 2019, 2:47:13 PM GMT+3, Dave C= ramer <davecramer@gmail.com> wrote:




On M= on, 30 Sep 2019 at 07:37, Alex <cdalxndr@yahoo.com> wrote:
What's the behavior when both "currentSchema" is s= pecified in the connection uri and "search_path" is overwritten to a differ= ent value by the app (inside the same transaction as the query)?

Initially the driver will set the search_path to whatever is in the = "currentSchema"
The driver doesn't do anything special if you cha= nge the search_path in a transaction, however:

The search_path setting will be set to whatever it was set to i= n the transaction if you commit. If you rollback it will rollback the setti= ng.

Dave
 





=20
=20
On Monday, September 30, 2019, 1:56:38 PM GMT+3, Dave C= ramer <davecramer= @gmail.com> wrote:


Alex,


=

On Mon, 30 Sep 2019 at 06:13= , Alex <cdalxndr@yaho= o.com> wrote:
<= div>
Additional info:
The origina= l 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 -&g= t; Save).

I= f I rename back the schema to original name, and use that name in "currentS= chema" param, then everything works correctly.

In addition, I don't know if any config= uration may override the connection param "currentSchema" (such as hibernat= e 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 =3D java.sql.DriverManager.getConnection("jdbc:postgresql://127.0= .0.1:5432/test?currentSchema=3Ddev,public","test","");

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

ResultSet rs =3D stmt.getResul= tSet();
if (!rs.next()) {
Assert.fail("'options' connection initialization parameter should be passed t= o the database.");
}
Assert.= assertEquals("'options' connection initialization param= eter should be passed to the database.", "dev,public", rs.getString(1));

stm= t.close();
TestUtil.= closeDB(con);
}

works fine.

Dave.&nb= sp; 


=20
=20
On Monday, September 30, 2019, 3:45:48 AM GMT+3, Dave C= ramer <davecramer= @gmail.com> wrote:


Intere= sting,

Thanks for the report.
<= br clear=3D"all">
Dave Cramer


On Thu, 26 Sep 2= 019 at 18:16, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged o= n 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=3Ddev,public&Ap= plicationName=3Dmyapp
Schema 'dev' has fts configuration 'en'.
Query (debugged PgPreparedStatement):
  select * from dev.category where category.language=3D'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.

------=_Part_1336167_1256003967.1569846263405--