Re: Crosstab Problems

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jorge Godoy <jgodoy(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
Subject: Re: Crosstab Problems
Date: 2007-10-25 02:26:16
Message-ID: 471FFEC8.4040409@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Tom Lane wrote:
> Jorge Godoy <jgodoy(at)gmail(dot)com> writes:
>> Em Thursday 18 October 2007 16:37:59 Joe Conway escreveu:
>>> The row is pretty useless without a rowid in this context -- it seems
>>> like the best thing to do would be to skip those rows entirely. Of
>>> course you could argue I suppose that it ought to throw an ERROR and
>>> bail out entirely. Maybe a good compromise would be to skip the row but
>>> throw a NOTICE?
>
>> If I were using it and having this problem I'd rather have an ERROR.
>
> I can think of four reasonably credible alternatives:
>
> 1. Treat NULL rowid as a category in its own right. This would conform
> with the behavior of GROUP BY and DISTINCT, for instance.

> 4. Silently ignore rows with NULL rowid.

After looking closer I realized that #4 was my original intention, and
there was even code attempting to implement it, but just not very well ;-(.

In any case, the attached changes the behavior to #1 for both flavors of
crosstab (the original crosstab(text, int) and the usually more useful
crosstab(text, text)).

It is appropriate for 8.3 but not back-patching as it changes behavior
in a non-backward compatible way and is probably too invasive anyway.
I'll do something much simpler just to prevent crashing for 8.2 and earlier.

If there are no objections I'll apply Thursday.

Joe

Attachment Content-Type Size
tablefunc.1.diff text/x-patch 6.7 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-10-25 03:01:08 Re: Selecting K random rows - efficiently!
Previous Message Paul Tillotson 2007-10-25 02:23:36 Re: Selecting K random rows - efficiently!

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2007-10-25 03:59:52 [Fwd: Re: [GENERAL] Crosstab Problems]
Previous Message Tom Lane 2007-10-24 22:00:15 Re: vacuum as flags in PGPROC