Re: array_lower /array_prepend doubt
От | Stephan Szabo |
---|---|
Тема | Re: array_lower /array_prepend doubt |
Дата | |
Msg-id | 20040121074533.J95018@megazone.bigpanda.com обсуждение исходный текст |
Ответ на | array_lower /array_prepend doubt (Rajesh Kumar Mallah <mallah@trade-india.com>) |
Список | pgsql-sql |
On Wed, 21 Jan 2004, Rajesh Kumar Mallah wrote: > can anyone explain why > SELECT array_lower(array_prepend(0, ARRAY[1,2,3]), 1); > returns 0 not 1 > > because > > tradein_clients=# SELECT array_prepend(0, ARRAY[1,2,3]); > +---------------+ > | array_prepend | > +---------------+ > | {0,1,2,3} | > +---------------+ > (1 row) It looks like array_prepend is basically inserting the new value at the index before the start of the array, so 0 is the lower bound. This means that array_prepend(0,ARRAY[1,2,3]) is not the same array as ARRAY[0,1,2,3]. If you stick both in a table, and select col[1], in one you appear to get back 1, in the other 0. However, I think there is a bug here somewhere, because the former array does not appear to dump/restore as the same value (both seem to dump as (0,1,2,3})
В списке pgsql-sql по дате отправления: