Re: BUG #16176: NULL value returned by category_sql argument tocrosstab() causes segmentation fault - Mailing list pgsql-bugs

From Joe Conway
Subject Re: BUG #16176: NULL value returned by category_sql argument tocrosstab() causes segmentation fault
Date
Msg-id 5103290c-be78-bb9c-eef2-eeeecee0bf23@joeconway.com
Whole thread Raw
In response to Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 12/23/19 1:49 PM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>> Pushed that way to all supported branches.
>
> Hmm, why'd you use ERRCODE_SYNTAX_ERROR, and not say
> ERRCODE_NULL_VALUE_NOT_ALLOWED?

To be consistent with the error just above:
--------------------
/*
 * The provided categories SQL query must always return one column:
 * category - the label or identifier for each column
 */
if (spi_tupdesc->natts != 1)
    ereport(ERROR,
    (errcode(ERRCODE_SYNTAX_ERROR),
     errmsg("provided \"categories\" SQL must " \
    "return 1 column of at least one row")));
--------------------

Also, the argument itself is a SQL statement, and it isn't NULL, it just
produces a NULL value as one (or more) of its output rows. It seems like
ERRCODE_NULL_VALUE_NOT_ALLOWED might be confusing.

But I am not married to ERRCODE_SYNTAX_ERROR if you think it ought to be
changed.

Joe
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development


Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault
Next
From: Tom Lane
Date:
Subject: Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault