Re: BUG #16325: Assert failure on partitioning by int for a textvalue with a collation - Mailing list pgsql-bugs

From Dmitry Dolgov
Subject Re: BUG #16325: Assert failure on partitioning by int for a textvalue with a collation
Date
Msg-id 20200403152910.rsdc2yg7bisqaltb@localhost
Whole thread Raw
In response to Re: BUG #16325: Assert failure on partitioning by int for a textvalue with a collation  (Michael Paquier <michael@paquier.xyz>)
Responses Re: BUG #16325: Assert failure on partitioning by int for a textvalue with a collation
List pgsql-bugs
> On Thu, Apr 02, 2020 at 11:01:50AM +0900, Michael Paquier wrote:
>
> > +        /*
> > +         * No need to check if exprCollOid is invalid, since if it would be,
> > +         * then transformCollateClause will throw an error earlier
> > +         */
> > +        if (!type_is_collatable(colType))
> > +            ereport(ERROR,
> > +                    (errcode(ERRCODE_DATATYPE_MISMATCH),
> > +                     errmsg("collations are not supported by type %s",
> > +                            format_type_be(colType))));
> > +
> >
> >          if (OidIsValid(exprCollOid) &&
> >              exprCollOid != DEFAULT_COLLATION_OID &&
> >              exprCollOid != partCollation)
>
> Another point that could be made is that as we know that we are in the
> presence of a CollateExpr() here, and exprCollOid will never be
> InvalidOid.  So there could be a point in using an assertion instead
> of the check done below making sure that exprCollOid is always valid?

Thanks for the suggestion. It's not strictly related to the fix I guess,
but of course you're right, and we can indeed improve this part and
replace the check with an assert.

Attachment

pgsql-bugs by date:

Previous
From: wcrowell
Date:
Subject: Re: BUG #16340: lo_manage() crashs DB instance
Next
From: Jehan-Guillaume de Rorthais
Date:
Subject: Re: [BUG] non archived WAL removed during production crash recovery