Visibility of a local variable

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
Thread:
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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavel Stehule 2024-06-03 18:11:40 Re: Missing semicolumn in anonymous plpgsql block does not raise syntax error
Previous Message Tom Lane 2024-06-03 17:50:22 Re: BUG #18492: Adding a toasted column to a table with an inherited temp table fails with Assert