Re: BUG #16325: Assert failure on partitioning by int for a text value with a collation

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16325: Assert failure on partitioning by int for a text value with a collation
Date: 2020-04-03 15:29:10
Message-ID: 20200403152910.rsdc2yg7bisqaltb@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
part_value_collations_v3.patch text/x-diff 2.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jehan-Guillaume de Rorthais 2020-04-03 16:26:25 Re: [BUG] non archived WAL removed during production crash recovery
Previous Message wcrowell 2020-04-03 15:02:20 Re: BUG #16340: lo_manage() crashs DB instance