Re: Schema variables - new implementation for Postgres 15 - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Schema variables - new implementation for Postgres 15
Date
Msg-id CAFj8pRB3j_J0c-8r9hfYnY-dKmFq3f7RxDmoQEPeoQndYdawVQ@mail.gmail.com
Whole thread Raw
In response to Re: Schema variables - new implementation for Postgres 15  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: Schema variables - new implementation for Postgres 15  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Hi

čt 30. 3. 2023 v 15:40 odesílatel Peter Eisentraut <peter.eisentraut@enterprisedb.com> napsal:
On 30.03.23 10:49, Pavel Stehule wrote:
> If I reorganize the patch to the following structure, can be it useful
> for you?
>
> 1. really basic functionality (no temporary variables, no def
> expressions, no memory cleaning)
>     SELECT variable
>     LET should be supported + doc, + related tests.
>
> 2. support for temporary variables (session, transaction scope),
>      memory cleaning at the end of transaction
>
> 3. PL/pgSQL support
> 4. pg_dump
> 5. shadowing warning
> 6. ... others ...

I am sending a refactorized patch. Mainly I rewrote memory cleaning - now it should be more robust and more simple (no more mem alloc in sinval handler).  Against the previous patch, only the syntax "LET var = DEFAULT" is not supported. I don't think it should be supported now. These patches are incremental - every patch contains related doc, regress tests and can be tested incrementally.

New organization

1. basic CREATE VARIABLE, DROP VARIABLE, GRANT, REVOKE, ALTER, pg_dump
2. basic SELECT var, LET var = value
3. DISCARD VARIABLES
4. cleaning memory used by dropped variables
5. temporary variables + ON COMMIT DROP clause support
6. ON TRANSACTION END RESET clause support
7. DEFAULT expr clause support
8. support NOT NULL and IMMUTABLE clauses
9. use message "column or variable doesn't exists" instead "column doesn't exists"

Regards

Pavel

 

That seems like an ok approach.  The pg_dump support should probably go
into the first patch, so it's self-contained.
Attachment

pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: Re: Do we want a hashset type?
Next
From: Peter Eisentraut
Date:
Subject: Re: Remove deprecation warnings when compiling PG ~13 with OpenSSL 3.0~