Re: Malformed Array Literal in PL/pgSQL Exception Block

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Malformed Array Literal in PL/pgSQL Exception Block
Date: 2017-04-10 04:59:04
Message-ID: 87h91wx3k8.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "David" == David E Wheeler <david(at)justatheory(dot)com> writes:

>> If you change this to EXCEPTION WHEN division_by_zero THEN, the
>> reported error becomes:
>>
>> ERROR: malformed array literal: "foo"
>> LINE 1: SELECT things || 'foo'

David> So the issue stands, yes?

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.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2017-04-10 05:07:13 Re: Malformed Array Literal in PL/pgSQL Exception Block
Previous Message David E. Wheeler 2017-04-10 04:53:42 Re: Malformed Array Literal in PL/pgSQL Exception Block