Re: How to raise error from PostgreSql SQL statement if some condition is met - Mailing list pgsql-general

From Craig Ringer
Subject Re: How to raise error from PostgreSql SQL statement if some condition is met
Date
Msg-id 5027A740.6000805@ringerc.id.au
Whole thread Raw
In response to Re: How to raise error from PostgreSql SQL statement if some condition is met  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
On 08/12/2012 06:02 PM, Andrus wrote:
>> ... RaiseException(text, variadic text[])
>> ..
>
>> VARIADIC is keyword, not datatype
>
> Thank you.
>
> I tried code below but got error shown in comment.
> No idea what I'm doing wrong.
>
> Andrus.
>
>
> CREATE OR REPLACE FUNCTION RaiseException(text, variadic text[] )
>   RETURNS void LANGUAGE plpgsql AS
> $BODY$
> BEGIN
>   -- ERROR:  syntax error at or near "$1"
>   RAISE EXCEPTION  $1, $2;

You probably want something like:

     RAISE EXCEPTION  "%: %", $1, $2;


pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Deleting BLOBs
Next
From: Stefan Keller
Date:
Subject: Re: Expression alias not recognized in WHERE clause (ERROR: relation "p" does not exist)