checking my understanding of TupleDesc

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: checking my understanding of TupleDesc
Date: 2019-09-30 00:13:32
Message-ID: 5D9148AC.3000600@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From looking around the code, I've made these tentative observations
about TupleDescs:

1. If the TupleDesc was obtained straight from the relcache for some
relation, then all of its attributes should have nonzero attrelid
identifying that relation, but in (every? nearly every?) other case,
the attributes found in a TupleDesc will have a dummy attrelid of zero.

2. The attributes in a TupleDesc will (always?) have consecutive attnum
corresponding to their positions in the TupleDesc (and therefore
redundant). A query, say, that projects out a subset of columns
from a relation will not have a result TupleDesc with attributes
still bearing their original attrelid and attnum; they'll have
attrelid zero and consecutive renumbered attnum.

Something like SendRowDescriptionCols_3 that wants the original table
and attnum has to reconstruct them from the targetlist if available,

Have I mistaken any of that?

Thanks,
-Chap

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-09-30 01:10:12 Re: pg_wal/RECOVERYHISTORY file remains after archive recovery
Previous Message Andres Freund 2019-09-29 23:30:29 Re: JIT performance bug/regression & JIT EXPLAIN