Re: How to raise error from PostgreSql SQL statement if some condition is met

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to raise error from PostgreSql SQL statement if some condition is met
Date: 2012-08-12 09:12:07
Message-ID: CAFj8pRAvqCtyE=Kd_Gn-Sw3M_h7hU43L1C4Jkq-oOTWWV4xELg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2012/8/12 Andrus <kobruleht2(at)hot(dot)ee>:
> Than you very much.
> It worked.
>
> I tried to extend it to pass message parameters. Tried code below but got
> syntax error. How to pass message parameters ?
>
> Andrus.
>
> CREATE OR REPLACE FUNCTION RaiseException(text, variadic )

... RaiseException(text, variadic text[])
..

VARIADIC is keyword, not datatype

Regards

Pavel Stehule

> RETURNS void LANGUAGE plpgsql AS
> $BODY$
> BEGIN
> RAISE EXCEPTION $1, $2;
> END;
> $BODY$;
>
> SELECT RaiseException('Exception Param1=% Param2=%', 'textvalue', 2 );

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2012-08-12 10:02:17 Re: How to raise error from PostgreSql SQL statement if some condition is met
Previous Message Andrus 2012-08-12 07:31:42 Re: How to raise error from PostgreSql SQL statement if some condition is met