Re: are there static variables in pgsql?

From: Kenneth Downs <ken(at)secdat(dot)com>
To:
Cc: Patrick TJ McPhee <ptjm(at)interlog(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: are there static variables in pgsql?
Date: 2006-06-12 15:20:45
Message-ID: 448D864D.2020003@secdat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kenneth Downs wrote:

OK, cancel the question, the answer is

SELECT current_setting('global.val2');

> This is very intriguing, but I'd like to make sure it is doing what I
> think it is doing. Is it tracking variables in a connection across
> SQL commands? If so, shouldn't this work (Assume the existence of
> table "detail" with a column called "val2").
>
> create or replace function SetVal2() returns void as
> $$
> begin
> update detail set val2=global.val2;
> end;
> $$
> language plpgsql
>
> set global.val2=5;
> select SetVal2();
>
> I'm getting the following error which I don't understand. Seems I
> don't know how to access the variable once it is set.
>
> ERROR: missing FROM-clause entry for table "global"
> CONTEXT: SQL statement "update detail set val2=global.val2"
> PL/pgSQL function "setval2" line 2 at SQL statement
>
>---------------------------(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
>
>

Attachment Content-Type Size
ken.vcf text/x-vcard 186 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2006-06-12 15:50:45 Re: Ever increasing OIDs - gonna run out soon?
Previous Message Lincoln Yeoh 2006-06-12 15:13:54 Re: Disk corruption detection