Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx> writes: > Hmm, nope -- take away the relnamespace check, because there is a > different namespace for each backend (pg_temp_2, pg_temp_3, etc). And > as far as I've seen, most leftover temp tables are on "high" temp > schemas (i.e. those belonging to backends that are only used when the > load is high). Yeah, because the low-numbered ones get recycled first. To have a temp table survive for long enough to create this problem, it's pretty much got to be in a high-numbered temp schema. regards, tom lane