Re: Raise exception without using plpgsql?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
Cc: Joel Jacobson <joel(at)compiler(dot)org>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Raise exception without using plpgsql?
Date: 2020-12-17 16:58:22
Message-ID: CAFj8pRD-Kt1tq2ssqihWirUTsEWg6LJ1ecM1YuJm_rdV_S8bkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

čt 17. 12. 2020 v 17:45 odesílatel hubert depesz lubaczewski <
depesz(at)depesz(dot)com> napsal:

> On Thu, Dec 17, 2020 at 03:32:09PM +0100, Joel Jacobson wrote:
> > Hi,
> > Is there a way to raise an exception with a message,
> > without having to add your own plpgsql helper-function?
> > Currently this is what I have:
>
> Well, you can:
> DO $$ begin raise notice 'zz'; END; $$;
> It's cheating though, as it still needs plpgsql.
>
> Best regards,
>

Some years there was discussion about this possibility

https://www.postgresql-archive.org/How-to-raise-error-from-PostgreSql-SQL-statement-if-some-condition-is-met-td5719585.html

There was another thread, but I cannot to find it

Regards

Pavel

> depesz
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig McIlwee 2020-12-17 17:21:45 Unexpected result count from update statement on partitioned table
Previous Message hubert depesz lubaczewski 2020-12-17 16:45:03 Re: Raise exception without using plpgsql?