Re: proposal: schema variables

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Erik Rijkers <er(at)xs4all(dot)nl>, Michael Paquier <michael(at)paquier(dot)xyz>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, DUVAL REMI <REMI(dot)DUVAL(at)cheops(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: proposal: schema variables
Date: 2024-12-20 12:53:20
Message-ID: CAFj8pRABA6q1crR35qusvcTy3tfrxAJ_9+b+e3DE0CBQSkTZGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Hi

----------------<<<>>>>-----------------------------
>> CREATE VARIABLE IF NOT EXISTS v2 AS comp;
>> grant update on variable v2 to alice;
>> set role alice;
>> LET v2.a = 12; --acl permission error
>> LET v2.b = 12; --acl permission error
>> LET v2 = (11,12); --ok.
>>
>
>
>
>>
>> not sure this is the desired behavior, for composite type variables, you
>> are
>> allowed to change all the values, but you are not allowed to update the
>> field
>> value of the composite. The following are normal table test update cases.
>>
>> create type comp as (a int, b int);
>> create table t2(a comp);
>> insert into t2 select '(11,12)';
>> grant update (a ) on t2 to alice;
>> set role alice;
>> update t2 set a.a = 13; --ok
>> update t2 set a.b = 13; --ok
>> update t2 set a = '(11,13)'; --ok
>>
>
> I think this is a bug, but I need more time for investigation. For field
> update you need to read the content
> the variable, but you are missing SELECT right on the variable, and then
> the LET fails. Unfortunately
> this is done inside the executor, so it is harder to fix it.
>
>
I fixed this issue - the change is done in Patch 02

Reards

Pavel

>
>

Attachment Content-Type Size
v20241220-0022-pg_restore-A-variable.patch text/x-patch 2.8 KB
v20241220-0020-this-patch-changes-error-message-column-doesn-t-exis.patch text/x-patch 29.1 KB
v20241220-0021-transactional-variables.patch text/x-patch 39.2 KB
v20241220-0018-plpgsql-implementation-for-LET-statement.patch text/x-patch 15.5 KB
v20241220-0019-expression-with-session-variables-can-be-inlined.patch text/x-patch 4.2 KB
v20241220-0017-allow-parallel-execution-queries-with-session-variab.patch text/x-patch 11.9 KB
v20241220-0016-allow-read-an-value-of-session-variable-directly-fro.patch text/x-patch 15.5 KB
v20241220-0015-Implementation-of-NOT-NULL-and-IMMUTABLE-clauses.patch text/x-patch 35.6 KB
v20241220-0014-Implementation-of-DEFAULT-clause-default-expressions.patch text/x-patch 33.6 KB
v20241220-0013-Implementation-ON-TRANSACTION-END-RESET-clause.patch text/x-patch 14.6 KB
v20241220-0012-implementation-of-temporary-session-variables.patch text/x-patch 42.0 KB
v20241220-0011-PREPARE-LET-support.patch text/x-patch 7.4 KB
v20241220-0009-dynamic-check-of-usage-of-session-variable-fences.patch text/x-patch 16.2 KB
v20241220-0010-EXPLAIN-LET-support.patch text/x-patch 8.2 KB
v20241220-0008-variable-fence-syntax-support-and-variable-fence-usa.patch text/x-patch 19.4 KB
v20241220-0007-GUC-session_variables_ambiguity_warning.patch text/x-patch 14.0 KB
v20241220-0006-plpgsql-tests.patch text/x-patch 16.9 KB
v20241220-0004-DISCARD-VARIABLES.patch text/x-patch 9.6 KB
v20241220-0005-memory-cleaning-after-DROP-VARIABLE.patch text/x-patch 21.0 KB
v20241220-0003-function-pg_session_variables-for-cleaning-tests.patch text/x-patch 4.3 KB
v20241220-0002-Storage-for-session-variables-and-SQL-interface.patch text/x-patch 151.6 KB
v20241220-0001-Enhancing-catalog-for-support-session-variables-and-.patch text/x-patch 165.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-12-20 14:03:17 Re: downgrade some aclchk.c errors to internal
Previous Message Jakub Wartak 2024-12-20 12:25:41 Re: FileFallocate misbehaving on XFS

Browse pgsql-performance by date

  From Date Subject
Next Message Jon Zeppieri 2024-12-20 21:01:57 Re: Why a bitmap scan in this case?
Previous Message Frédéric Yhuel 2024-12-20 09:57:40 Re: Why a bitmap scan in this case?