From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Marcos Pegoraro <marcos(at)f10(dot)com(dot)br> |
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-11-20 14:57:23 |
Message-ID: | CAFj8pRAhYzyJX=3==si+195Bu6DGLLKGjZthe9LnmsekAGjyaA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-performance |
st 20. 11. 2024 v 15:15 odesílatel Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
napsal:
> Em qua., 20 de nov. de 2024 às 10:52, Pavel Stehule <
> pavel(dot)stehule(at)gmail(dot)com> escreveu:
>
>> COMMIT can be a little bit messy. TRANSACTION END is more intuitive, I
>> think.
>>
>>>
> Exactly to be not messy I would just ON COMMIT for all, and DOCs can
> explain that this option is ignored for temp objects and do the same at the
> end of transaction, independently if commited or rolled back
>
I feel it differently - when I read ON COMMIT, then I expect really just a
COMMIT event, not ROLLBACK. Attention - the metadata about variables are
transactional, but the variables are not transactional (by default).
But this feeling can be subjective. The objective argument against using ON
COMMIT like ON TRANSACTION END is fact, so we lost a possibility for a more
precious setting.
I can imagine scenarios with ON COMMIT RESET - and variable can hold some
last value from transaction, or ON ROLLBACK RESET - and variable can hold
some computed value from successfully ended transaction - last inserted id.
In this case, I don't see a problem to reopen a discussion about syntax or
postpone this feature. I think the possibility to reset variables at some
specified time can be an interesting feature (that can increase safety,
because the application doesn't need to solve initial setup), but from the
list of implemented features for session variables, this is not too far
from the end. If TRANSACTION END is not intuitive - with exactly the same
functionality can be RESET AT TRANSACTION START - so the ON TRANSACTION END
can be transformed to ON BEGIN RESET, and this syntax can be maybe better,
because it signalize, for every transaction, the variable will be
initialized to default. What do you think? Can be ON BEGIN RESET acceptable
for you.
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2024-11-20 15:02:52 | Re: Remove useless casts to (void *) |
Previous Message | Yogesh Sharma | 2024-11-20 14:48:58 | Re: allow changing autovacuum_max_workers without restarting |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-11-20 15:46:06 | Re: Has gen_random_uuid() gotten much slower in v17? |
Previous Message | Marcos Pegoraro | 2024-11-20 14:14:55 | Re: proposal: schema variables |