Thread: Problem in "Set search path"

Problem in "Set search path"

From
Kalai R
Date:
Hi,

   I am using postgresql 9.0.3.  In my application I change often schema name using set search path. Some times schema name set correctly.  But some time it does not set correctly and it takes the schema previously I set.  Is any possibilities to happen like this?
Thank You.
 

Re: Problem in "Set search path"

From
Chris Angelico
Date:
On Thu, Mar 21, 2013 at 11:33 PM, Kalai R <softlinne.kv@gmail.com> wrote:
> Hi,
>
>    I am using postgresql 9.0.3.  In my application I change often schema
> name using set search path. Some times schema name set correctly.  But some
> time it does not set correctly and it takes the schema previously I set.  Is
> any possibilities to happen like this?

If you roll back the transaction in which you set it, it isn't set,
but if you commit that transaction, it'll stay set for future
transactions. At least, that's been my experience.

ChrisA


Re: Problem in "Set search path"

From
Pavel Stehule
Date:
Hello

2013/3/21 Kalai R <softlinne.kv@gmail.com>:
> Hi,
>
>    I am using postgresql 9.0.3.  In my application I change often schema
> name using set search path. Some times schema name set correctly.  But some
> time it does not set correctly and it takes the schema previously I set.  Is
> any possibilities to happen like this?

yes, it is possible - if you use prepared statement.

Regards

Pavel Stehule

> Thank You.
>


Re: Problem in "Set search path"

From
Kalai R
Date:
Hi,
 Thanks for ur suggestions. I create connection from my .net application and set search path by single query. After set search path I call psql function from my .net application using the same connection. In this case some time search path set but some times not. I didn't use prepare statement.
Regards
kalai
On Thu, Mar 21, 2013 at 6:09 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
Hello

2013/3/21 Kalai R <softlinne.kv@gmail.com>:
> Hi,
>
>    I am using postgresql 9.0.3.  In my application I change often schema
> name using set search path. Some times schema name set correctly.  But some
> time it does not set correctly and it takes the schema previously I set.  Is
> any possibilities to happen like this?

yes, it is possible - if you use prepared statement.

Regards

Pavel Stehule

> Thank You.
>

Re: Problem in "Set search path"

From
Adrian Klaver
Date:
On 03/21/2013 08:59 AM, Kalai R wrote:
> Hi,
>   Thanks for ur suggestions. I create connection from my .net
> application and set search path by single query. After set search path I
> call psql function from my .net application using the same connection.
> In this case some time search path set but some times not. I didn't use
> prepare statement.

Might try temporarily turning up the logging in postgresql.conf to 'all'
and see what is actually being done on the server.

> Regards
> kalai


--
Adrian Klaver
adrian.klaver@gmail.com


Re: Problem in "Set search path"

From
Alban Hertroys
Date:
On 21 March 2013 16:59, Kalai R <softlinne.kv@gmail.com> wrote:
Hi,
 Thanks for ur suggestions. I create connection from my .net application and set search path by single query. After set search path I call psql function from my .net application using the same connection. In this case some time search path set but some times not. I didn't use prepare statement.
 
Is that the same connection object in ,NET or the same connection to a connection pool or the same database connection? That's not necessarily the same.

Do you still have this problem if you set the search_path at the start of your transaction?

Did you know you can set a search_path on user (role) objects and on database objects in the database? That might just take out your need to specify it in your ,NET application.
--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

Problem in "Set search path"

From
Kalai R
Date:


---------- Forwarded message ----------
From: Kalai R <softlinne.kv@gmail.com>
Date: Fri, Mar 22, 2013 at 9:36 AM
Subject: Re: [GENERAL] Problem in "Set search path"
To: Alban Hertroys <haramrae@gmail.com>


Hi,
 
Is that the same connection object in ,NET or the same connection to a connection pool or the same database connection? That's not necessarily the same.
I use the same npgsql connection object in .net
 
 
Might try temporarily turning up the logging in postgresql.conf to 'all' and see what is actually being done on the server.

Did you know you can set a search_path on user (role) objects and on database objects in the database? That might just take out your need to specify it in your ,NET application.

I try to find out my problem by your ideas. Thanks guys.
 
Regards
Kalai


Re: Problem in "Set search path"

From
"Francisco Figueiredo Jr."
Date:

Did you try to set the search_path in the connection string? This way you won't need to set the search_path manually. Npgsql will take care of it to you.

I hope it helps.



On Fri, Mar 22, 2013 at 1:07 AM, Kalai R <softlinne.kv@gmail.com> wrote:


---------- Forwarded message ----------
From: Kalai R <softlinne.kv@gmail.com>
Date: Fri, Mar 22, 2013 at 9:36 AM
Subject: Re: [GENERAL] Problem in "Set search path"
To: Alban Hertroys <haramrae@gmail.com>


Hi,
 
Is that the same connection object in ,NET or the same connection to a connection pool or the same database connection? That's not necessarily the same.
I use the same npgsql connection object in .net
 
 
Might try temporarily turning up the logging in postgresql.conf to 'all' and see what is actually being done on the server.

Did you know you can set a search_path on user (role) objects and on database objects in the database? That might just take out your need to specify it in your ,NET application.

I try to find out my problem by your ideas. Thanks guys.
 
Regards
Kalai





--
Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior