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

From Andrew Gierth
Subject Re: [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block
Date
Msg-id 87lgr8x3vp.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-hackers
>>>>> "David" == David E Wheeler <david@justatheory.com> writes:
David> And it works great, including in PL/pgSQL functions, except inDavid> an exception block. When I run this:
David>     BEGIN;
David>     CREATE OR REPLACE FUNCTION foo(David>     ) RETURNS BOOLEAN IMMUTABLE LANGUAGE PLPGSQL AS $$David>
DECLAREDavid>        things TEXT[] := '{}';David>     BEGINDavid>         things := things || 'foo';David>
RAISEdivision_by_zero;
 

This "raise" statement is not reached, because the previous line raises
the "malformed array literal" error.
David>     EXCEPTION WHEN OTHERS THEN

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'

-- 
Andrew (irc:RhodiumToad)



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] [COMMITTERS] pgsql: Sync pg_dump and pg_dumpall output
Next
From: "David E. Wheeler"
Date:
Subject: Re: [HACKERS] Malformed Array Literal in PL/pgSQL Exception Block