How to drop a subscription inside a stored procedure?

2022-06-10 Thread Thomas Kellerer
I am trying to write a stored procedure (Postgres 13) to enable non-superusers to re-create a subscription. For that, I essentially want to drop and re-create the subscription. In order to be able to do that, the tables need to be empty. So the approach is: Run a query to get all replicated t

Re: How to drop a subscription inside a stored procedure?

2022-06-10 Thread Adrian Klaver
On 6/10/22 05:57, Thomas Kellerer wrote: I am trying to write a stored procedure (Postgres 13) to enable non-superusers to re-create a subscription. However, the "drop subscription" part results in this error: ERROR: DROP SUBSCRIPTION cannot be executed from a function CONTEXT: S

How to get response message

2022-06-10 Thread Rama Krishnan
Hi All, I am want to delete old records using function so my senior has function like below but I want to get response of this particular inside query wheter it is successful or failure How to get response of the function status create or replace function data_purge() returns void as$$ Declare

Re: How to get response message

2022-06-10 Thread Adrian Klaver
On 6/10/22 09:37, Rama Krishnan wrote: Hi All, I am want to delete old records using function so my senior has function like below but I want to get response of this particular inside query wheter it is successful or failure How to get response of the function status  create or replace fun

Re: How to get response message

2022-06-10 Thread Francisco Olarte
On Fri, 10 Jun 2022 at 18:38, Rama Krishnan wrote: > > Hi All, > > I am want to delete old records using function so my senior has function like > below but I want to get response of this particular inside query wheter it is > successful or failure > How to get response of the function status

Re: How to get response message

2022-06-10 Thread David G. Johnston
On Fri, Jun 10, 2022 at 9:38 AM Rama Krishnan wrote: > I am want to delete old records using function so my senior has function > like below but I want to get response of this particular inside query > wheter it is successful or failure > If it doesn't error, it was successful. That is basicall

Need optimization in query

2022-06-10 Thread Shubham Mittal
Hi Team. *I have a use case to get the result as follows:* 1. asin_ymm is never null. 2. If there is more than 1 entry for an asin_ymm with both null and non-null submodelId, I should return rows with non-null submodelId only, otherwise if there is no submodelid present for a asin_ymm, then retur

Re: How to drop a subscription inside a stored procedure?

2022-06-10 Thread Thomas Kellerer
Adrian Klaver schrieb am 10.06.2022 um 16:58: On 6/10/22 05:57, Thomas Kellerer wrote: I am trying to write a stored procedure (Postgres 13) to enable non-superusers to re-create a subscription. However, the "drop subscription" part results in this error: ERROR:  DROP SUBSCRIPTION cannot