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.