Re: clarify equalTupleDescs()

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: clarify equalTupleDescs()
Date: 2024-02-12 12:49:46
Message-ID: 0054cd47-da6b-4fde-924e-69512630e6a2@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06.02.24 16:14, Tom Lane wrote:
> Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
>> The first want to compare what I call row-type equality, which means
>> they want to check specifically for equal number of attributes, and the
>> same attribute names, types, and typmods for each attribute. Most
>> callers actually want that behavior.
>
> Should compare attcollation too, no?
>
> +1 for the general idea, but it seems like "row type equality"
> might still be a slightly fuzzy concept.

I did another pass across the callers to check what pg_attribute fields
might be relevant.

Collation definitely needs to be added, certainly for plancache.c, maybe
for typcache.c, the other callers don't care.

Record types can have attisdropped fields, so it's probably good to
check those.

I'm suspicious about attndims. Maybe one could create a test case where
record types differ only in that. Support for attndims throughout the
system is weak, but maybe there is something to check there.

On a conceptual level, I figured pg_attribute rows can be divided up
into three categories:

1. "row type" stuff: attname, atttypid, atttypmod, attndims,
attisdropped, attcollation

2. physical layout stuff: attlen, attcacheoff, attbyval, attalign

3. table metadata stuff (everything else)

It's not perfect, and sometimes it's not clear whether these categories
inform the implementation or the other way around, but I think it helps
conceptualize it.

Attachment Content-Type Size
v1-0001-Separate-equalRowTypes-from-equalTupleDescs.patch text/plain 11.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-02-12 13:00:00 Re: [PATCH] Add sortsupport for range types and btree_gist
Previous Message Andrei Zubkov 2024-02-12 12:30:58 Re: Add connection active, idle time to pg_stat_activity