pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: ipluta@wp.pl
Cc: pgsql-bugs@lists.postgresql.org, Joe Conway <mail@joeconway.com>
Subject: Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault
Date: Fri, 20 Dec 2019 13:00:59 -0500
Message-ID: <8638.1576864859@sss.pgh.pa.us> (raw)
In-Reply-To: <16176-7489719b05e4303c@postgresql.org>
References: <16176-7489719b05e4303c@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
>     -- this will crash pg12, but not version() < 12 - note NULL value in
> categories query:
>     select * from crosstab ('values (1, 2, 12), (1, 3, 13), (2, 2, 22), (2,
> 3, 23), (3, 2, 32), (3, 3, 33) order by 1, 2, 3', 'values (2), (null)') as
> rr (a int, "2" int, "3" int);

Yeah, duplicated here.  It seems tablefunc is passing a NULL string
pointer to sprintf().  Previously, that would work on some platforms
and crash on others --- as of v12, it crashes everywhere.

What we need here is to figure out what the hashtab string key ought
to be for a NULL category.  I suspect what was happening before
(on non-crashing platforms) was that you implicitly got "(nil)"
or some spelling like that, which is not great because it could
conflict with a valid user key.  Alternatively, we could refuse
NULL category values ... not sure if that's desirable.

Anyway, this is *not* a new bug, it's just possible to hit it on
more platforms now.

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <8638.1576864859@sss.pgh.pa.us>
Permalink:  ../8638.1576864859@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8638.1576864859@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, ipluta@wp.pl, mail@joeconway.com
  Subject: Re: BUG #16176: NULL value returned by category_sql argument to crosstab() causes segmentation fault
  In-Reply-To: <8638.1576864859@sss.pgh.pa.us>

* 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