Re: Bad behavior from plpython 'return []'

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bad behavior from plpython 'return []'
Date: 2016-07-01 18:00:25
Message-ID: CA+TgmoY7Oe1RQ3hJ9oHgYmz_D7PTjfYXbb3beLkW4bVBCpuW_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 30, 2016 at 9:25 PM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> 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)
>
> Erm?? Turns out this is because
>
> SELECT array_dims(pg_temp.bad()), array_dims('{}'::text[]);
> array_dims | array_dims
> ------------+------------
> [1:0] |
> (1 row)

Yeah, that's a bug.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-07-01 18:01:42 Re: Broken handling of lwlocknames.h
Previous Message Alvaro Herrera 2016-07-01 17:56:15 Re: primary_conninfo missing from pg_stat_wal_receiver