Lists: | pgsql-general |
---|
From: | Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Constaints |
Date: | 2004-12-05 16:55:33 |
Message-ID: | 41B33D85.6010507@users.sourceforge.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Is there anyway to declare a constant that you can then use within a
postgresql 'session', i am connecting from a PHP based application and
trying to integrate another.
What I want to be able to do is setup a rule on another table so that
whenever a query is run on the table it appends another value to the query.
i.e i want to be able to do:
'SET someconstant an_id=1;'
Then with a rule, running:
SELECT * FROM a_table
would become:
SELECT * FROM a_table WHERE id=a_id
is this possible?
Thanks
Jake
From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Constaints |
Date: | 2004-12-05 17:33:00 |
Message-ID: | 20041205173300.GA11530@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Sun, Dec 05, 2004 at 16:55:33 +0000,
Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> wrote:
> Is there anyway to declare a constant that you can then use within a
> postgresql 'session', i am connecting from a PHP based application and
> trying to integrate another.
>
> What I want to be able to do is setup a rule on another table so that
> whenever a query is run on the table it appends another value to the query.
>
> i.e i want to be able to do:
>
> 'SET someconstant an_id=1;'
>
> Then with a rule, running:
>
> SELECT * FROM a_table
>
> would become:
>
> SELECT * FROM a_table WHERE id=a_id
>
> is this possible?
At the worst you should be able to use a table with a row for each session
that includes the value to be used for each session.
From: | Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Constaints |
Date: | 2004-12-05 17:48:32 |
Message-ID: | 41B349F0.8050203@users.sourceforge.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Bruno Wolff III wrote:
>On Sun, Dec 05, 2004 at 16:55:33 +0000,
> Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> wrote:
>
>
>>Is there anyway to declare a constant that you can then use within a
>>postgresql 'session', i am connecting from a PHP based application and
>>trying to integrate another.
>>
>>
>
>At the worst you should be able to use a table with a row for each session
>that includes the value to be used for each session.
>
>
Would this be a postgresql session? If so how do I go about accessing it
from a query/setting the value of it? I have looked at set authorization
but I don't think this is where I should be looking!
Thanks
Jake
From: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
---|---|
To: | Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> |
Cc: | Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Constaints |
Date: | 2004-12-05 17:58:52 |
Message-ID: | 41B34C5C.5080504@Yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On 12/5/2004 12:48 PM, Jake Stride wrote:
> Bruno Wolff III wrote:
>
>>On Sun, Dec 05, 2004 at 16:55:33 +0000,
>> Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> wrote:
>>
>>
>>>Is there anyway to declare a constant that you can then use within a
>>>postgresql 'session', i am connecting from a PHP based application and
>>>trying to integrate another.
>>>
>>>
>>
>>At the worst you should be able to use a table with a row for each session
>>that includes the value to be used for each session.
>>
>>
> Would this be a postgresql session? If so how do I go about accessing it
> from a query/setting the value of it? I have looked at set authorization
> but I don't think this is where I should be looking!
PostgreSQL does not have userland session variables. You would have to
write some custom set/get functions in a procedural language that is
capable of holding global data across function calls (like PL/Tcl).
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Constaints |
Date: | 2004-12-05 21:40:45 |
Message-ID: | 20041205214045.GA19853@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Sun, Dec 05, 2004 at 17:48:32 +0000,
Jake Stride <nsuk(at)users(dot)sourceforge(dot)net> wrote:
> Would this be a postgresql session? If so how do I go about accessing it
> from a query/setting the value of it? I have looked at set authorization
> but I don't think this is where I should be looking!
At the start of each session you use an insert or update to update
the table with the values using the session id (process id) as the key.
Your views can refer to this table and the session id to get the appropiate
value.
From: | Andrew - Supernews <andrew+nonews(at)supernews(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Constaints |
Date: | 2004-12-06 01:43:56 |
Message-ID: | slrncr7eas.sjo.andrew+nonews@trinity.supernews.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On 2004-12-05, Jan Wieck <JanWieck(at)Yahoo(dot)com> wrote:
> PostgreSQL does not have userland session variables. You would have to
> write some custom set/get functions in a procedural language that is
> capable of holding global data across function calls (like PL/Tcl).
You can fake session variables by using constant-returning functions
defined in the per-session temporary namespace.
--
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services