Re: [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block
Date
Msg-id 0836F9B0-5171-4DCD-BF75-8D8726144462@justatheory.com
Whole thread Raw
In response to Re: [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
On Apr 9, 2017, at 9:59 PM, Andrew Gierth <andrew@tao11.riddles.org.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
withoutcasting ‘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
returnsa ::text, so no ambiguity. Guess that’s my issue. 

Thanks,

David


pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block
Next
From: Andrew Gierth
Date:
Subject: Re: [HACKERS] [sqlsmith] Planner crash on foreign table join