Re: join of array
От
elein
Тема
Re: join of array
Дата
Msg-id
20030815102614.E22348@cookie
Ответ на
Re: join of array (Joe Conway)
Список
Дерево обсуждения
join of array Pavel Stehule <stehule@kix.fsv.cvut.cz>
Re: join of array Tom Lane <tgl@sss.pgh.pa.us>
Re: join of array Joe Conway <mail@joeconway.com>
Re: join of array Tom Lane <tgl@sss.pgh.pa.us>
Re: join of array Joe Conway <mail@joeconway.com>
Arrays and "goodness" in RDBMSs (was Re: join of array) Ron Johnson <ron.l.johnson@cox.net>
Re: Arrays and "goodness" in RDBMSs (was Re: join of array) elein <elein@varlena.com>
Re: Arrays and "goodness" in RDBMSs (was Re: join of Ron Johnson <ron.l.johnson@cox.net>
Re: Arrays and "goodness" in RDBMSs (was Re: join of elein <elein@varlena.com>
Re: Arrays and "goodness" in RDBMSs (was Re: join of "Andrew L. Gould" <algould@datawok.com>
Re: Arrays and "goodness" in RDBMSs (was Re: join of Ron Johnson <ron.l.johnson@cox.net>
Re: Arrays and "goodness" in RDBMSs (was Re: join of array) "Andrew L. Gould" <algould@datawok.com>
Re: Arrays and "goodness" in RDBMSs (was Re: join of array) "Matthew D. Fuller" <fullermd@over-yonder.net>
Re: join of array elein <elein@varlena.com>
Re: join of array Joe Conway <mail@joeconway.com>
Re: join of array Tom Lane <tgl@sss.pgh.pa.us>
Re: join of array Joe Conway <mail@joeconway.com>
Re: join of array Tom Lane <tgl@sss.pgh.pa.us>
Re: join of array Tino Wildenhain <tino@wildenhain.de>
Re: join of array elein <elein@varlena.com>
Re: join of array Joe Conway <mail@joeconway.com>
Re: join of array elein <elein@varlena.com>
summary and request expect <expect@ihubbell.com>
Re: summary and request Jason Godden <jasongodden@optushome.com.au>
Re: summary and request expect <expect@ihubbell.com>
Re: summary and request - correction Jason Godden <jasongodden@optushome.com.au>
you said we had:
> We also have
> ARRAY[1,2] || 3 == '{1,2,3}'
> and
> ARRAY[[1,2],[3,4]] || ARRAY[5,6] == '{{1,2},{3,4},{5,6}}'
> and
> ARRAY[[1,2],[3,4]] || ARRAY[[1,2],[3,4]] ==
> '{{{1,2},{3,4}},{{1,2},{3,4}}}'
>
> I think the first two still make sense. I guess the third case ought to be:
> ARRAY[[1,2],[3,4]] || ARRAY[[1,2],[3,4]] ==
> '{{1,2},{3,4},{1,2},{3,4}}'
The second case above makes this case wrong. Or vice versa.
It is dereferencing the right operand in one case and
not in the other. How exactly do you tell the difference?
The only difference I can tell is the depth of the
left hand array. This is confusing and unnecessarily complex.
> It makes sense in analogy to
> ARRAY[1,2] || ARRAY[3,4] == '{1,2,3,4}'
This case should be '{1,2,{3,4}}'.
Unless we have a flattening operator or dereferencing function.
Or a policy of always flattening the right operand one
level (confusing!).
Consistent treatment of the operands is important. Treating
object (arrays) as they were defined makes the nesting
and usage easier. Not to mention the implementation.
(Good problem :-)
Elein
On Fri, Aug 15, 2003 at 10:06:36AM -0700, Joe Conway wrote:
> elein wrote:
> >> ARRAY[[1,2],[3,4]] || ARRAY[[1,2],[3,4]] ==
> >> '{{{1,2},{3,4}},{{1,2},{3,4}}}'
> >>
> >>I think the first two still make sense. I guess the third case ought to
> >>be:
> >> ARRAY[[1,2],[3,4]] || ARRAY[[1,2],[3,4]] ==
> >> '{{1,2},{3,4},{1,2},{3,4}}'
> >>?
> >
> >I do not think this is right. I think the current behaviour
> >is right. You are effectively dereferencing or flattening
> >the second array which changes the definition of the second
> >object.
>
> It makes sense in analogy to
> ARRAY[1,2] || ARRAY[3,4] == '{1,2,3,4}'
>
> In the case of, e.g. ARRAY[[1,2],[3,4]] || ARRAY[[5,6],[7,8]],
> '{1,2}', '{3,4}', '{5,6}', and '{7,8}' are "elements" of the higher
> level array, just like 1, 2, 3, & 4 are elements of '{1,2,3,4}'
>
> Joe
>
В списке pgsql-general по дате отправления