Re: Is replacing transactions with CTE a good idea?
От | Glen Huang |
---|---|
Тема | Re: Is replacing transactions with CTE a good idea? |
Дата | |
Msg-id | 79097C11-B045-4D98-A427-4A82477E2634@gmail.com обсуждение исходный текст |
Ответ на | Re: Is replacing transactions with CTE a good idea? (Brian Dunavant <dunavant@gmail.com>) |
Ответы |
Re: Is replacing transactions with CTE a good idea?
|
Список | pgsql-general |
> When you deal with updates/deletes, things can be trickier
Care to expand why they are tricker? I presume they run the risk of being referenced more than once?
On Apr 1, 2021, at 10:58 PM, Brian Dunavant <dunavant@gmail.com> wrote:
On Thu, Apr 1, 2021 at 10:49 AM Glen Huang <heyhgl@gmail.com> wrote:If I decide to replace all my transaction code with CTE, will I shoot myself in the foot down the road?I do this all the time and makes code way cleaner. It's very straightforward with inserts queries. When you deal with updates/deletes, things can be trickier. I usually leave these in a transaction if there is any concern.They can also be hard for future programmers that may not understand SQL. Make sure you comment your queries for maintainability long term.I have yet to regret replacing a transaction with a CTE over the past decade. YMMV
В списке pgsql-general по дате отправления: