From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | John McCawley <nospam(at)hardgeus(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Any form of connection-level "session variable" ? |
Date: | 2007-01-04 20:01:08 |
Message-ID: | 459D5D04.7050309@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane wrote:
> John McCawley <nospam(at)hardgeus(dot)com> writes:
>
>> I think I got it:
>> CREATE FUNCTION new_get_emp_id() RETURNS INTEGER AS $$ select emp_id
>> from secureview.tbl_employee where username = (SELECT current_user) $$
>> LANGUAGE SQL IMMUTABLE;
>> I made the function immutable so it only calls it once, therefore no
>> longer requiring a call per-row.
>>
>
> Since it's obviously *not* immutable, this will come back to bite you
> sooner or later (probably sooner). Labeling it STABLE would be
> reasonable, although I'm not certain how much that helps you. Do you
> have indexes on the columns it's being compared to?
>
Besides, a temp table is pretty much a session variable.
--
erik jones <erik(at)myemma(dot)com>
software development
emma(r)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-01-04 20:13:24 | Re: Any form of connection-level "session variable" ? |
Previous Message | Tom Lane | 2007-01-04 19:48:59 | Re: Any form of connection-level "session variable" ? |