public inbox for [email protected]
help / color / mirror / Atom feedFrom: Heikki Linnakangas <[email protected]>
To: Chao Li <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: CheckAttributeType() forgot to recurse into multiranges
Date: Thu, 23 Apr 2026 21:49:04 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
On 23/04/2026 06:24, Chao Li wrote:
> I traced this patch set, 0002 looks good, but I have a suspicion about 0001.
>
> ```
> + else if (att_typtype == TYPTYPE_MULTIRANGE)
> + {
> + /*
> + * If it's a multirange, recurse to check its plain range type.
> + */
> + CheckAttributeType(attname, get_multirange_range(atttypid),
> + get_range_collation(atttypid),
> + containing_rowtypes,
> + flags);
> + }
> ```
>
> Looking at get_range_collation(), it only searches for RANGETYPE, so get_range_collation(atttypid) here will always return InvalidOid. This does not seem to cause a problem, because CheckAttributeType() will recurse into the TYPTYPE_RANGE path, and the collation will be evaluated there.
>
> But to make the logic clearer, I think we could just pass InvalidOid as the collation OID in the TYPTYPE_MULTIRANGE case. If we really want to pass the actual collation OID here, I think it would need to be done more like this:
>
> ```
> else if (att_typtype == TYPTYPE_MULTIRANGE)
> {
> Oid multirange_range_typid = get_multirange_range(atttypid);
> Oid collation = get_range_collation(multirange_range_typid);
> /*
> * If it's a multirange, recurse to check its plain range type.
> */
> CheckAttributeType(attname, multirange_range_typid,
> collation,
> containing_rowtypes,
> flags);
> }
> ```
Oh, good catch, this is subtle. I'll change it to InvalidOid. As long as
range types are not collatable, that'll do the right thing. If range
types were collatable, I'm not sure what the right thing would be. It
depends on what exactly the collation of a range type would mean.
So, pushed with InvalidOid. Thanks for the review!
- Heikki
view thread (4+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: CheckAttributeType() forgot to recurse into multiranges
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox