Re: proposal: row_to_array function

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: row_to_array function
Дата
Msg-id CAFj8pRByquDbnCGENLFdkt68P-6E9K-+nh=1SrN_J=qRY55J3g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: row_to_array function  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: proposal: row_to_array function  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
<p dir="ltr"><br /> Dne 28.1.2015 0:25 "Jim Nasby" <<a
href="mailto:Jim.Nasby@bluetreble.com">Jim.Nasby@bluetreble.com</a>>napsal(a):<br /> ><br /> > On 1/27/15
12:58PM, Pavel Stehule wrote:<br /> >><br /> >>       postgres=# select array(select
unnest('{{{1,2},{3,4}},{{5,6},{7,8}}}'::int[]));<br/> >>             array<br /> >>    
-------------------<br/> >>       {1,2,3,4,5,6,7,8}<br /> >>     (1 row)<br /> >><br /> >>    
soit generate pairs {1,2}{3,4},{5,6},{7,8}<br /> >><br /> >><br /> >> I fixed situation when array
hasnot enough elements.<br /> >><br /> >> More tests, simple doc<br /> ><br /> ><br /> > Hrm, this
wasn'twhat I was expecting:<br /> ><br /> > + select foreach_test_ab(array[1,2,3,4]);<br /> > + NOTICE:  a: 1,
b:2<br /> > + NOTICE:  a: 3, b: 4<br /> ><br /> > I was expecting that foreach a,b array would be expecting
somethingin the array to have a dimension of 2. :(<p dir="ltr">It is inconsist (your expectation) with current
implementationof FOREACH. It doesnt produce a array when SLICING is missing. And it doesnt calculate with dimensions.<p
dir="ltr">Iwould not to change this rule. It is not ambigonuous and it allows to work with<br /> 1d, 2d, 3d dimensions
array.You can process Andrew format well and my proposed format (2d array) well too. <p dir="ltr">There can be differen
behavewhen SLICING is used. There we can iterate exactly with dimensions. We can design a behave in this case?<br /><p
dir="ltr">><br/> > I think this is bad, because this:<br /> ><br /> >
foreach_test_ab('{{1,2,3},{4,5,6}}'::int[]);<br/> ><br /> > will give you 1,2; 3,4; 5,6. I don't see any way that
thatmakes sense. Even if it did make sense, I'm more concerned that adding this will seriously paint us into a corner
whenit comes to the (to me) more rational case of returning {1,2,3},{4,5,6}.<br /> ><br /> > I think we need to
thinksome more about this, at least to make sure we're not painting ourselves into a corner for more appropriate array
iteration.<br/> ><br /> > -- <br /> > Jim Nasby, Data Architect, Blue Treble Consulting<br /> > Data in
Trouble?Get it in Treble! <a href="http://BlueTreble.com">http://BlueTreble.com</a><br /> 

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

Предыдущее
От: Abhijit Menon-Sen
Дата:
Сообщение: Re: a fast bloat measurement tool (was Re: Measuring relation free space)
Следующее
От: Noah Misch
Дата:
Сообщение: Re: jsonb, unicode escapes and escaped backslashes