Re: Malformed Array Literal in PL/pgSQL Exception Block

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Malformed Array Literal in PL/pgSQL Exception Block
Date: 2017-04-10 05:07:13
Message-ID: 0836F9B0-5171-4DCD-BF75-8D8726144462@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Apr 9, 2017, at 9:59 PM, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:

> Tom's response has the explanation of why it fails (everywhere, not just
> in the exception block): parse analysis prefers to match the (array ||
> array) form of the operator when given input of (array || unknown). Just
> cast the 'foo' to the array element type.

Tried to reduce this from some code I’m working on. I have a whole bunch of code that appends to an array in this way without casting ‘foo’ to text or text[]. It’s only in an exception block that it’s complaining.

Hrm, looking back through my code, it looks like I’m mostly calling format() to append to an array, which of course returns a ::text, so no ambiguity. Guess that’s my issue.

Thanks,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2017-04-10 05:14:42 Re: [sqlsmith] Planner crash on foreign table join
Previous Message Andrew Gierth 2017-04-10 04:59:04 Re: Malformed Array Literal in PL/pgSQL Exception Block