On 2021-Jul-26, Tom Lane wrote: > On the other hand, I don't like 0002 one bit, because it's not accounting > for whether the temp schema it's mangling is *our own* temp schema or some > other session's. I do not think it is wise or even safe to report some > other temp schema as being "pg_temp". By the same token, I wonder whether > this bit in event_trigger.c is a good idea or a safety hazard: > > /* XXX not quite get_namespace_name_or_temp */ > if (isAnyTempNamespace(schema_oid)) > schema = pstrdup("pg_temp"); > else > schema = get_namespace_name(schema_oid);
Oh, you meant this one. To be honest I don't remember *why* this code wants to show remote temp tables as just "pg_temp" ... it's possible that some test in the DDL-to-JSON code depended on this behavior. Without spending too much time analyzing it, I agree that it seems dangerous and might lead to referring to unintended objects. (Really, my memory is not clear on *why* we would be referring to temp tables of other sessions.) -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/ "No necesitamos banderas No reconocemos fronteras" (Jorge González)