Does TZConnection respect the schema settings of PostgreSQL?

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
vfclists
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: 30.10.2007, 00:07

Does TZConnection respect the schema settings of PostgreSQL?

Post by vfclists »

I am using the TZConnection from Zeoslib and although I set the schema in the connection, when I run a query it seems to revert to the PUBLIC schema. Unless I prefix tablenames with the schema name like

Code: Select all

select schemaname.tablename from schema
the queries don't work

Are schemas properly supported by Zeoslib?
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by EgonHugeist »

First of all switch to 7.2 to be on same band width.
And accordingly your question:

Yes of course we do and this is our default syntax. We also add the catalog like <catalog>.<schema>.<tablename>

Postgre uses case-sensitive identifiers. IS "PUBLIC" realy the name of the schema or is it "public"? Work case sensitive..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
wxin
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 06.09.2020, 20:45

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by wxin »

I am having the same issue, and don't get the answer from this thread.

I am using PostgreSQL, how can I designate a specific schema using TZConnection, instead of connection to the default "public" schema?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1916
Joined: 17.01.2011, 14:17

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by marsupilami »

Hello,

usually it should be possible to change the default schema using the catalog property.

Best regards,

Jan
wxin
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 06.09.2020, 20:45

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by wxin »

Thank you for you kind reply. I am using 7.3.0-alpha, and Catalog doesn't seem to work?
marsupilami wrote: 07.09.2020, 09:54 Hello,

usually it should be possible to change the default schema using the catalog property.

Best regards,

Jan
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1916
Joined: 17.01.2011, 14:17

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by marsupilami »

In that case I can only suggest to use something like MyZeosConnection.ExecuteDirect('SET search_path TO myschema,public;').
I created a feature request for tracking this: https://sourceforge.net/p/zeoslib/internaltickets/11/
wxin
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 06.09.2020, 20:45

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by wxin »

Thank you very much for the kind advice.
vonhabsi
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 17.02.2024, 13:15

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by vonhabsi »

marsupilami wrote: 10.09.2020, 10:20 In that case I can only suggest to use something like MyZeosConnection.ExecuteDirect('SET search_path TO myschema,public;').
I created a feature request for tracking this: https://sourceforge.net/p/zeoslib/internaltickets/11/
It looks like the URL generated for libpq.dll does not include the search_path.

Where can the connection strings sent to libpq.dll be checked?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1916
Joined: 17.01.2011, 14:17

Re: Does TZConnection respect the schema settings of PostgreSQL?

Post by marsupilami »

Hello :)
vonhabsi wrote: 17.02.2024, 13:36 It looks like the URL generated for libpq.dll does not include the search_path.
No - it doesn't. This is what all this is about.
vonhabsi wrote: 17.02.2024, 13:36 Where can the connection strings sent to libpq.dll be checked?
Right now they can only be checked in the code when debugging. Have a look at ZDbcPostgreSql.pas.

Best regards,

Jan
Post Reply