Lists: | Postg범퍼카 토토SQL : Postg범퍼카 토토SQL 메일 링리스트 : 2024-06-04 이후 PGSQL-BUGS 17:05 |
---|
From: | Alejandro Burne <adburne(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Visibility of a local variable |
Date: | 2024-06-03 18:11:06 |
Message-ID: | CAOKeeVj8s0DcjcTUULEOXGB3Ro7ZmwcV=O-wX44Aqdx7BQo1TA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
A local variable, created within a transaction, continues to persist
(without value) after the transaction has ended.
> select version();
PostgreSQL 12.15 (Ubuntu 12.15-1.pgdg18.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
> select current_setting('my.var1');
ERROR: parámetro de configuración «my.var1» no reconocido SQL state: 42704
(as expected)
> begin;
> set local my.var1 = true;
> commit;
(everything ok)
> select current_setting('my.var1');
returns an empty field (current_setting)
It should return the same error as in the first statement
Greetings, Alejandro
From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Alejandro Burne <adburne(at)gmail(dot)com> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Visibility of a local variable |
Date: | 2024-06-04 16:01:56 |
Message-ID: | CAKFQuwYBxmU8kw6zrZXdwWP85Y6n3WkrBhaboBVPjg3EyPJHrw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Monday, June 3, 2024, Alejandro Burne <adburne(at)gmail(dot)com> wrote:
> A local variable, created within a transaction, continues to persist
> (without value) after the transaction has ended.
>
>
This is under-documented but at present there is no plan to change this
long-standing behavior, just document it better.
Once a session knows a variable exists it cannot be made to not exist.
Only set back to its default empty string value (since custom variables are
only of type text)
David J.
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Alejandro Burne <adburne(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Visibility of a local variable |
Date: | 2024-06-04 17:05:57 |
Message-ID: | 479909.1717520757@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | Postg범퍼카 토토SQL : Postg범퍼카 토토SQL 메일 링리스트 : 2024-06-04 이후 PGSQL-BUGS 17:05 |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Monday, June 3, 2024, Alejandro Burne <adburne(at)gmail(dot)com> wrote:
>> A local variable, created within a transaction, continues to persist
>> (without value) after the transaction has ended.
> This is under-documented but at present there is no plan to change this
> long-standing behavior, just document it better.
Keep in mind that this entire behavior (ie the ability to create GUCs
not declared in the C code) is an undocumented abuse of the GUC
system. We probably can't get rid of it at this late date, but
we're very unlikely to make any incompatible changes in the behavior.
regards, tom lane
From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Alejandro Burne <adburne(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Visibility of a local variable |
Date: | 2024-06-04 19:55:29 |
Message-ID: | CAKFQuwamy3VGC29STPvAJu0c9mMtOEknZX6FaWaw2idYGb5JPw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Tue, Jun 4, 2024 at 10:05 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Monday, June 3, 2024, Alejandro Burne <adburne(at)gmail(dot)com> wrote:
> >> A local variable, created within a transaction, continues to persist
> >> (without value) after the transaction has ended.
>
> > This is under-documented but at present there is no plan to change this
> > long-standing behavior, just document it better.
>
> Keep in mind that this entire behavior (ie the ability to create GUCs
> not declared in the C code) is an undocumented abuse of the GUC
> system. We probably can't get rid of it at this late date, but
> we're very unlikely to make any incompatible changes in the behavior.
>
>
No, but this is another indication that there is demand for Pavel's schema
variables feature that it would be nice to point to instead of saying this
usable behavior is unsupported and has no supported alternatives.
David J.