Re: join of array

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: join of array
Дата
Msg-id 3F3D1A36.3000808@joeconway.com
обсуждение исходный текст
Ответ на Re: join of array  (elein <elein@varlena.com>)
Ответы Re: join of array  (elein <elein@varlena.com>)
Список pgsql-general
elein wrote:
> you said we had:
>
>>We also have
      ^^^^

There are two variants each of two cases. The first case is what started
this discussion. The newest reading of the SQL99 spec says that we
*must* do this:
1a)  ARRAY[1,2] || ARRAY[3,4] == '{1,2,3,4}'

Quoting the paragraph provided by Tom:
"c) Otherwise, the result is the array comprising every element
     of AV1 followed by every element of AV2."

The variant is that when you have an "array of arrays", i.e. a
multidimensional array (which Peter E pointed out earlier is part of
SQL99 too), the spec wording implies that we also *must* do this:
1b)  ARRAY[[1],[2]] || ARRAY[[3],[4]] == '{{1},{2},{3},{4}'


The second case is not directly addressed by the spec as far as I can
see, i.e. it is a Postgres extension. That is:
2a)  ARRAY[1,2] || 3 == '{1,2,3}'

So by analogy the multidimensional variant is:
2b)  ARRAY[[1],[2]] || ARRAY[3] == '{{1},{2},{3}}'

Cases 1a and 1b are currently wrong according to the spec., and that's
the change we've been discussing. Cases 2a and 2b currently work as
shown and are correct IMHO (although Tom pointed out a lower bound index
issue that I'll address in my response to him).

Does this help?

Joe


В списке pgsql-general по дате отправления:

Предыдущее
От: Franco Bruno Borghesi
Дата:
Сообщение: Re: New to list, quick question.
Следующее
От: Joe Conway
Дата:
Сообщение: Re: join of array