Scheduling pg_repack job with pg_cron

2024-07-30 Thread Durgamahesh Manne
Hi Respected Team Is there any way to schedule a pg_repack job with pg_cron within the instance ? If yes then please please let me know the best approach to schedule it with pg_cron within the instance.( not in bastion host) your response is highly valuable Regards. Durga Mahesh

Re: Scheduling pg_repack job with pg_cron

2024-07-30 Thread Muhammad Imtiaz
Hi , Yes, you can use it. Create a bash script containing the pg_repack command logic, then call this bash script from a PL/pgSQL function. Finally, schedule this PL/pgSQL function using pg_cron as follows. SELECT cron.schedule('pg_repack_job', '00 3 * * 1-5', $$SELECT repackfunc();$$); *Muhamma

Understanding conflicts on publications and subscriptions

2024-07-30 Thread Koen De Groote
Reading this document: https://www.postgresql.org/docs/16/logical-replication-conflicts.html There is talk of the "disable_on_error" option when creating a subscription. The conflicts this applies to, I am assuming are only conflicts caused on the side of the subscription? As an attempt to apply

Re: Understanding conflicts on publications and subscriptions

2024-07-30 Thread Koen De Groote
Just to add a thought: If the subscriber gets a bit of logic to say "Something went wrong, so I'm automatically stopping what I'm doing", it sounds logical to give the publisher the same ability. On Tue, Jul 30, 2024 at 3:47 PM Koen De Groote wrote: > Reading this document: > https://www.postgr

Re: Understanding conflicts on publications and subscriptions

2024-07-30 Thread David G. Johnston
On Tuesday, July 30, 2024, Koen De Groote wrote: > > If the subscriber gets a bit of logic to say "Something went wrong, so I'm > automatically stopping what I'm doing", it sounds logical to give the > publisher the same ability. > The wording for that option is: Specifies whether the subscripti

Re: Understanding conflicts on publications and subscriptions

2024-07-30 Thread Koen De Groote
David, By "addition" do you mean "adding the table to the publication"? I suppose that's an option, though I was more thinking about disabling the publication if an error occurs, similarly to how a subscription is disabled if "disable_on_error" is set to true, and an error occurs there. However,

Re: Understanding conflicts on publications and subscriptions

2024-07-30 Thread David G. Johnston
On Tue, Jul 30, 2024 at 7:16 AM Koen De Groote wrote: > And if my understanding is correct: if a table doesn't have a replica > identity, any UPDATE or DELETE statement that happens on the publisher, for > that table, will be refused. > > That is how I read the sentence "Otherwise those operatio

Trigger usecase

2024-07-30 Thread sud
Hello, We have a streaming application (using apache flink and kafka) which populates data in the tables of a postgres database version 15.4. Now while loading transactions data we also get some reference data information from source (for example customer information) and for these , we dont want

Re: Trigger usecase

2024-07-30 Thread David G. Johnston
On Tue, Jul 30, 2024 at 8:16 AM sud wrote: > > I understand, technically its possible bith the way, but want to > understand experts opinion on this and pros ans cons? > > Have client code call a function that performs the relevant work directly instead of having a trigger perform similar work.

Re: Trigger usecase

2024-07-30 Thread Laurenz Albe
On Tue, 2024-07-30 at 20:46 +0530, sud wrote: > Now while loading transactions data we also get some reference data > information from > source (for example customer information) and for these , we dont want to > modify or > override the existing customer data but want to keep the old data with a

Re: Trigger usecase

2024-07-30 Thread sud
On Tue, Jul 30, 2024 at 10:54 PM Laurenz Albe wrote: > > It is largely a matter of taste. > > The advantage of a trigger is that it works even if somebody bypasses the > application > to insert data. > > I think that triggers are easy to debug, but again, that's a matter of > taste. > > > Thank y

Re: Trigger usecase

2024-07-30 Thread Adrian Klaver
On 7/30/24 11:46, sud wrote: On Tue, Jul 30, 2024 at 10:54 PM Laurenz Albe > wrote: It is largely a matter of taste. The advantage of a trigger is that it works even if somebody bypasses the application to insert data. I think that trigge

Re: Trigger usecase

2024-07-30 Thread David G. Johnston
On Tue, Jul 30, 2024 at 11:46 AM sud wrote: > > Not sure of the exact pros and cons, but we were following certain rules > like , if it's business logic which needs to be implemented in Database, > then it should not be done using triggers but rather should be done through > database procedure/fu

Re: Trigger usecase

2024-07-30 Thread Adrian Klaver
On 7/30/24 13:28, David G. Johnston wrote: On Tue, Jul 30, 2024 at 11:46 AM sud > wrote: Not sure of the exact pros and cons, but we were following certain rules like , if it's business logic which needs to be implemented in Database, then it should not be

Re: Understanding conflicts on publications and subscriptions

2024-07-30 Thread Koen De Groote
It indeed seems to be that. My initial thought of " will be disallowed on those tables" was "on the subscriber side". After all, why have a publication be of any effect if there's nobody subscribing to it. But it appears the publication influences behavior, regardless of there being a subscriber,

Re: Trigger usecase

2024-07-30 Thread Alban Hertroys
> On 30 Jul 2024, at 17:16, sud wrote: > > Hello, > > We have a streaming application (using apache flink and kafka) which > populates data in the tables of a postgres database version 15.4. > > Now while loading transactions data we also get some reference data > information from source (