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

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: How to raise error from PostgreSql SQL statement if some condition is met
Дата
Msg-id 5027A740.6000805@ringerc.id.au
обсуждение исходный текст
Ответ на Re: How to raise error from PostgreSql SQL statement if some condition is met  ("Andrus" <kobruleht2@hot.ee>)
Список 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 по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Deleting BLOBs
Следующее
От: Stefan Keller
Дата:
Сообщение: Re: Expression alias not recognized in WHERE clause (ERROR: relation "p" does not exist)