POSTGRES CTE value not being used in WHERE clause
I’m trying to run this query that updates an ordering
column after inserting the rows, and everything seems to work fine except using the id FROM the CTE query in the WHERE clause doesn’t work, even though it works everywhere else. This is the query
How to update same table in two CTEs in postgresql
So it seems requests of a CTE update cannot be used in the WHERE clause of another CTE on the same table?
Multi CTEs function optimization approach
I have a couple of CTEs in my function which I need to optimize as much as possible for speed.