From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Rama Krishnan <raghuldrag(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Function inside query status |
Date: | 2022-06-30 14:40:13 |
Message-ID: | a950e012-c367-5196-b98f-429713346fde@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 6/29/22 23:57, Rama Krishnan wrote:
> Hi All,
>
>
> Is it possible to check the query execution status inside the function.
>
>
>
> created or replace function data_purge() returns void as$$
> Declare
> Begin
> Drop table test_old;
> Create table test_old as select * from sales where bill_date<now()
> -interval '1 year';
>
> Delete table sales where sales_id in (select sales_id from test_old;
1) You are not actually declaring anything so the Declare is not needed.
2) You have three queries in the function do you want to check them all
or some subset?
3) What exactly are checking for?
4) Have you looked at?:
https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS
and
>
> End;
> $$ language plpgsql;
>
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Bryn Llewellyn | 2022-06-30 18:33:42 | Re: User's responsibility when using a chain of "immutable" functions? |
Previous Message | Tom Lane | 2022-06-30 13:27:04 | Re: Fatel: unsupported frientend protocol error |