Add TupleDescGetDefault()
authorPeter Eisentraut <[email protected]>
Wed, 27 Sep 2023 17:52:40 +0000 (18:52 +0100)
committerPeter Eisentraut <[email protected]>
Wed, 27 Sep 2023 17:52:40 +0000 (18:52 +0100)
commitebf76f2753a91615d45f113f1535a8443fa8d076
treecb82bc6f663156a233fbff877a03ff97959fd298
parent9dce22033d5d2813e9f8e7d595f57ee5a38b3f8e
Add TupleDescGetDefault()

This unifies some repetitive code.

Note: I didn't push the "not found" error message into the new
function, even though all existing callers would be able to make use
of it.  Using the existing error handling as-is would probably require
exposing the Relation type via tupdesc.h, which doesn't seem
desirable.  (Or even if we changed it to just report the OID, it would
inject the concept of a relation containing the tuple descriptor into
tupdesc.h, which might be a layering violation.  Perhaps some further
improvements could be considered here separately.)

Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da%40eisentraut.org
src/backend/access/common/tupdesc.c
src/backend/commands/tablecmds.c
src/backend/parser/parse_utilcmd.c
src/backend/rewrite/rewriteHandler.c
src/include/access/tupdesc.h