Re: join of array
От
elein
Тема
Re: join of array
Дата
Msg-id
20030815095443.C22348@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>
>
> 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.
The ability to do the dereference/flattening is useful,
but it is not the || operator. How about |* which would
flatten 1 level? Of course, that begs the question
of what about n levels and I'm not sure about that.
--elein
On Fri, Aug 15, 2003 at 08:34:14AM -0700, Joe Conway wrote:
> Tom Lane wrote:
> >Pavel Stehule writes:
> >
> >>Is possible merge two arrays like
> >>array[1,2,3] + array[4,5,6] => array[1,2,3,4,5,6]
> >
> >
> >I was about to say that || would do it, but I see that's not quite
> >right:
> >
> >regression=# SELECT ARRAY[1,2,3] || ARRAY[4,5,6];
> > ?column?
> >-------------------
> > {{1,2,3},{4,5,6}}
> >(1 row)
> >
> >Offhand, I would think that '{1,2,3,4,5,6}' would be what I'd
> >intuitively expect to get from "concatenating" these arrays.
> >Joe, do we really have this implemented per spec?
> >
>
> Hmmm, it made sense to me, at at least at some point ;-). Here's the
> SQL99 guidance (SQL200X doesn't give any more detailed guidance):
>
> 4.11.3.2 Operators that operate on array values and return array values
> is an operation that returns the array value made
> by joining its array value operands in the order given.
>
> So I guess it ought to be changed.
>
> 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}}'
> ?
>
> If this sounds good, I'll work on a patch for the behavior as well as
> the docs.
>
> Joe
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
В списке pgsql-general по дате отправления