pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: ipluta@wp.pl
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault
Date: Mon, 23 Dec 2019 14:00:38 -0500
Message-ID: <5103290c-be78-bb9c-eef2-eeeecee0bf23@joeconway.com> (raw)
In-Reply-To: <19151.1577126972@sss.pgh.pa.us>
References: <16176-7489719b05e4303c@postgresql.org>
	<8638.1576864859@sss.pgh.pa.us>
	<8d8ef71e-a347-67be-696a-3bdd259ec9fb@joeconway.com>
	<12400.1576940917@sss.pgh.pa.us>
	<208f13a0-0433-6780-802d-fedcff3c8991@joeconway.com>
	<19151.1577126972@sss.pgh.pa.us>

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (9+ messages)  latest in thread

Message-ID: <5103290c-be78-bb9c-eef2-eeeecee0bf23@joeconway.com>
Permalink:  ../5103290c-be78-bb9c-eef2-eeeecee0bf23@joeconway.com/
Also on:    postgresql.org/message-id/5103290c-be78-bb9c-eef2-eeeecee0bf23@joeconway.com

 · 

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: pgsql-bugs@postgresql.org
  Cc: mail@joeconway.com, tgl@sss.pgh.pa.us, ipluta@wp.pl, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault
  In-Reply-To: <5103290c-be78-bb9c-eef2-eeeecee0bf23@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox