Is there a way to check in PostgreSQL that a table has the same row type as a given record type (composite type)?
This is a follow-up question to Check if two tables have the same structure (are compatible).
Basically, I want to avoid using temporary tables as they tend to cause problem with
max_locks_per_transaction. What I wanted to do is to check if an existing table has the desired row type that equals an existing record type. e.g. the same type as that of
SELECT 1::bigint, NULL::geometry;.
If so, I can
truncate and reuse the existing table. Otherwise, I drop the incompatible table and re-create it.
Is there a way to check if a table has the given row type, without creating a temporary table in the process?