Re: [HACKERS] Bad behavior from plpython 'return []'

2016-07-01 Thread Jim Nasby
On 7/1/16 2:52 PM, Tom Lane wrote: + /* if caller tries to specify zero-length array, make it empty */ + if (nelems <= 0) + return construct_empty_array(elmtype); + /* compute required space */ nbytes = 0; hasnulls = false; But that might

Re: [HACKERS] Bad behavior from plpython 'return []'

2016-07-01 Thread Tom Lane
Robert Haas writes: > On Thu, Jun 30, 2016 at 9:25 PM, Jim Nasby wrote: >> SELECT array_dims(pg_temp.bad()), array_dims('{}'::text[]); >> array_dims | array_dims >> + >> [1:0] | >> (1 row) > Yeah, that's a bug. It

Re: [HACKERS] Bad behavior from plpython 'return []'

2016-07-01 Thread Robert Haas
On Thu, Jun 30, 2016 at 9:25 PM, Jim Nasby wrote: > CREATE FUNCTION pg_temp.bad() RETURNS text[] LANGUAGE plpythonu AS $$return > []$$; > SELECT pg_temp.bad(); > bad > - > {} > (1 row) > > SELECT pg_temp.bad() = '{}'::text[]; > ?column? > -- > f > (1 row)

[HACKERS] Bad behavior from plpython 'return []'

2016-06-30 Thread Jim Nasby
CREATE FUNCTION pg_temp.bad() RETURNS text[] LANGUAGE plpythonu AS $$return []$$; SELECT pg_temp.bad(); bad - {} (1 row) SELECT pg_temp.bad() = '{}'::text[]; ?column? -- f (1 row) Erm?? Turns out this is because SELECT array_dims(pg_temp.bad()), array_dims('{}'::text[]);