dbTalk Databases Forums  

[BUGS] BUG #1858: setting search path in select doesn't (always) work

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1858: setting search path in select doesn't (always) work in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
D.J. Kniep
 
Posts: n/a

Default [BUGS] BUG #1858: setting search path in select doesn't (always) work - 09-02-2005 , 08:20 AM







The following bug has been logged online:

Bug reference: 1858
Logged by: D.J. Kniep
Email address: dick.kniep (AT) lindix (DOT) nl
PostgreSQL version: 7.4.8
Operating system: Linux (SuSE 9.3) /RedHat ES 4
Description: setting search path in select doesn't (always) work
Details:

we have been running a Zope site with Postgresql 7.4.8 for a while. In this
installation almost the first statement is:

cvix=# SELECT set_config('search_path', '"' || t2.schema || '"', true)
cvix-# FROM "Lindix"."Gebruikers" as t1, "Lindix"."Administratie" as t2
cvix-# WHERE uid = 'zon0023'
cvix-# AND t1.administratie_id = t2.administratie_id;
set_config
------------------
"adeuxproductie"
(1 row)

As you can see, I have a fixed schema called "Lindix" where the actual
destination schema is in a table. Depending on the user, the search_path is
set and it will be able to find the table.

Now we have installed a new server, with the same db version, the same
content (a restore from the original db) and the same coding.

After setting the search path the query

Select * from vwexternetoegang

produces the required results in the first installation, but in the new
installation, it cannot find the view. However, if I do an explicit

Set search_path to "testschema";

it works as expected.

The only real difference between the 2 installations I see is that the
working installation has a RedHat Enterprise Linux ES Release 4 (Nahant
update1) version versus the new (not working) a SuSE 9.3 installation

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1858: setting search path in select doesn't (always) work - 09-02-2005 , 10:01 AM






"D.J. Kniep" <dick.kniep (AT) lindix (DOT) nl> writes:
Quote:
After setting the search path the query
Select * from vwexternetoegang
produces the required results in the first installation, but in the new
installation, it cannot find the view. However, if I do an explicit
Set search_path to "testschema";
it works as expected.
What does "show search_path" report in the failing and non-failing states?
Also try "select current_schemas(true)".

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #3  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1858: setting search path in select doesn't (always) work - 09-02-2005 , 10:34 AM



On Fri, Sep 02, 2005 at 10:58:12AM -0400, Tom Lane wrote:
Quote:
"D.J. Kniep" <dick.kniep (AT) lindix (DOT) nl> writes:
After setting the search path the query
Select * from vwexternetoegang
produces the required results in the first installation, but in the new
installation, it cannot find the view. However, if I do an explicit
Set search_path to "testschema";
it works as expected.

What does "show search_path" report in the failing and non-failing states?
Also try "select current_schemas(true)".
This thread came up in pgsql-general yesterday; Dick says the real
problem was something else.

http://archives.postgresql.org/pgsql...9/msg00074.php

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #4  
Old   
Dick Kniep
 
Posts: n/a

Default Re: [BUGS] BUG #1858: setting search path in select doesn't (always) work - 09-03-2005 , 09:23 AM



Hi list,

I reported the bug because I was convinced it was something fishy, however,
the bug I reported proved to be something completely else. I don't even know
if it is a bug at all. If you do a set search_path; the path is set
correctly according to the rules of autocommit and everything else.

If however you are not authorized to use the schema, the next query on a table
within the requested schema results in a table not found condition, which
makes sense, because it actually cannot find the table, because it cannot
enter the schema.

I have checked the way psycopg handles this, and if a select is done on the
table this is working correctly,

File "/home/dick/CVix/CVix/src/ObjectBuilder.py", line 516, in __BldTabDef
cur.execute(Sqlstmt)
psycopg.ProgrammingError: ERROR: permission denied for schema adeuxproductie

Select * from "adeuxproductie"."parameters" WHERE 1=0

so the problem must be within Zope and I will report this problem to the Zope
community.

Thanks for all your help.

Op vrijdag 2 september 2005 17:12, schreef Michael Fuhr:
Quote:
On Fri, Sep 02, 2005 at 10:58:12AM -0400, Tom Lane wrote:
"D.J. Kniep" <dick.kniep (AT) lindix (DOT) nl> writes:
After setting the search path the query
Select * from vwexternetoegang
produces the required results in the first installation, but in the new
installation, it cannot find the view. However, if I do an explicit
Set search_path to "testschema";
it works as expected.

What does "show search_path" report in the failing and non-failing
states? Also try "select current_schemas(true)".

This thread came up in pgsql-general yesterday; Dick says the real
problem was something else.

http://archives.postgresql.org/pgsql...9/msg00074.php
Cheers,
Dick Kniep

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.