Re: patch: bytea_agg
| От | Tom Lane |
|---|---|
| Тема | Re: patch: bytea_agg |
| Дата | |
| Msg-id | 2278.1333809488@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: patch: bytea_agg (Peter Eisentraut <peter_e@gmx.net>) |
| Ответы |
Re: patch: bytea_agg
|
| Список | pgsql-hackers |
Peter Eisentraut <peter_e@gmx.net> writes:
> On ons, 2012-04-04 at 18:59 -0400, Tom Lane wrote:
>> Uh, no. That test is there for good and sufficient reasons, as per its
>> comment:
> I had reviewed that thread very carefully, but I'm not sure it applies.
> The issue was that we don't want aggregates with optional second
> argument, because "novices" could confuse
> agg(a, b ORDER BY c)
> with
> agg(a ORDER BY b, c) -- wrong
> without the error being flagged.
> But that doesn't apply if the first argument has different types.
> Erroneously calling agg(textdatum ORDER BY textdatum, sthelse) will not
> result in a call to agg(bytea).
The point of the policy is to be sure that we will throw a specific
error message with a suitable hint when a malformed call is made.
If there are alternative aggregates in the catalogs that have the
potential to "capture" such a call, then we risk the wrong thing
happening. It appears that the lack of any implicit cast from bytea to
text would prevent that today, but I still think this proposal boxes
us in to an unreasonable degree compared to the benefit. For example,
this would greatly restrict our ability to throw "ambiguous aggregate"
messages.
> Nevertheless, the problem would now be that adding string_agg(bytea)
> would effectively forbid adding string_agg(bytea, delim) in the future.
> So making a two-argument string_agg(bytea, bytea) now seems like the
> best solution anyway. (This applies independently of the function
> renaming, actually.)
Hm. So are you now suggesting we should get rid of one-argument
bytea_agg and replace it with two-argument string_agg(bytea,bytea)?
I could support that, since we've not released bytea_agg yet.
regards, tom lane
В списке pgsql-hackers по дате отправления: