Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: ipluta(at)wp(dot)pl, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault
Date: 2019-12-23 19:00:38
Message-ID: 5103290c-be78-bb9c-eef2-eeeecee0bf23@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 12/23/19 1:49 PM, Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-12-23 20:06:32 Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault
Previous Message Tom Lane 2019-12-23 18:49:32 Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault