Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)
Date
Msg-id 28052.1281035761@sss.pgh.pa.us
Whole thread Raw
In response to Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)  (Robert Haas <robertmhaas@gmail.com>)
Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
Josh Berkus <josh@agliodbs.com> writes:
>> Well, maybe we need to expend some more sweat on the error message then.
>> But this patch was still a prerequisite thing, because without it there
>> is no error that we can complain about.

> Yes, I'd say an addition to the HINT is in order *assuming* at that
> stage we can tell if the user passed an ORDER BY or not.

I was just looking at this, and realized I was mistaken earlier: the
error is issued in ParseFuncOrColumn, which already is passed the
agg_order list, so actually it's completely trivial to tell whether
a variant error message is appropriate.  I suggest that we key it off
there being not just an ORDER BY, but an ORDER BY with more than one
element; if there's only one then this cannot be the source of
confusion.

Next question: exactly how should the variant HINT be phrased?
I'm inclined to drop the bit about explicit casts and make it read
something like

HINT: No aggregate function matches the given name and argument
types. Perhaps you misplaced ORDER BY; ORDER BY must appear after all
regular arguments of the aggregate.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)
Next
From: Robert Haas
Date:
Subject: Re: Drop one-argument string_agg? (was Re: [BUGS] string_agg delimiter having no effect with order by)