In Postgres, is a WITH
clause creating a temporary table and if so can it be used in multiple threads safely ?
I.e. WITH x below, would this be ok if the CTE running in multiple different threads?
WITH x AS (
SELECT psp_id
FROM global.prospect
WHERE status IN ('new', 'reset')
ORDER BY request_ts
LIMIT 1
)
UPDATE global.prospect psp
SET status = status || '*'
FROM x
WHERE psp.psp_id = x.psp_id
RETURNING psp.*;