Re: proposal: schema variables

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: schema variables
Дата
Msg-id CAFj8pRCaFzRKWx3y64RQzw1-Jb8g4-LPu3b5byH9=us5JTRGgg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: schema variables  (Marcos Pegoraro <marcos@f10.com.br>)
Ответы Re: proposal: schema variables
Список pgsql-hackers
Hi

st 20. 11. 2024 v 14:29 odesílatel Marcos Pegoraro <marcos@f10.com.br> napsal:
Em ter., 19 de nov. de 2024 às 16:15, Pavel Stehule <pavel.stehule@gmail.com> escreveu:
I wrote POC of VARIABLE(varname) syntax support

Not related with POC of VARIABLE but seeing your patches ...

Wouldn't it be better to use just one syntax and message for what to do ON COMMIT ?

When creating a new variable you use 
CREATE VARIABLE ... ON COMMIT DROP | ON TRANSACTION END RESET

On PSQL \dV+ you show 
Transactional end action

Maybe all them could be just ON COMMIT
CREATE VARIABLE ... [ON COMMIT {NO ACTION, DROP, RESET}] and \dV+ just "on commit" on title column

ON COMMIT DROP is related to temporary objects. In this case, you don't need to think about ROLLBACK, because in this case, the temp objects are removed implicitly.

ON TRANSACTION END RESET can be used for non temporary objects too. So this is a little bit of a different feature. But the reset is executed if the transaction is ended by ROLLBACK too. So using a syntax just ON COMMIT can be a little bit messy. TRANSACTION END is more intuitive, I think. If I remember there was a proposal ON COMMIT OR ROLLBACK, but I think TRANSACTION END is better and more intuitive, and better describes what is implemented. I can imagine to support clauses ON COMMIT RESET or ON ROLLBACK RESET that can be used independently, but for this time, I don't want to increase a complexity now - reset is just at transaction end without dependency if the transaction was committed or rollbacked.

Regards

Pavel


regards
Marcos

В списке pgsql-hackers по дате отправления: