How to send INSERT/UPDATE without CTE for PostgreSQL? #150
Unanswered
kevinelliott
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Currently CTE is used everywhere within ORM. It is used extensively to enable multiple queries to be optimally executed by the database engine. The SELECT is mainly used to return the ID generated by auto increment primary key. Dropping the SELECT would break this logic. I'll take a look if there is a better way to address this besides dropping the CTE which would require a major rework. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently when inserting or updating a record, the ORM is issuing the query as a CTE (WITH ... UPDATE ... SELECT). This impedes the ability to send reads to replicas via the front pooler (pgcat) because it breaks the transaction, resulting with errors like:
Solution for this would be to allow INSERT/UPDATE without CTE style, with a methodology something like:
This would allow for UPDATEs and INSERTs to be sent without CTE.
Beta Was this translation helpful? Give feedback.
All reactions