RE: INSERT Trigger to check for existing records : Does this do what I hope it is doing?

2020-11-25 Thread hagen
[Hagen] Answers inline -Original Message- From: Adrian Klaver Sent: Wednesday, November 25, 2020 10:13 AM To: ha...@datasundae.com; pgsql-general@lists.postgresql.org Subject: Re: INSERT Trigger to check for existing records : Does this do what I hope it is doing? On 11/25/20 8:43

RE: INSERT Trigger to check for existing records : Does this do what I hope it is doing?

2020-11-25 Thread hagen
test parameter field. Then the UPDATE should flag all the hygiene_119 records as SAME or NEW. Obviously I don't REALLY need both flags as the absence of a flag would indicate status too. Does that articulate the thought process adequately? Best, Hagen -Original Message- From: Adrian K

Re: INSERT Trigger to check for existing records : Does this do what I hope it is doing?

2020-11-25 Thread Hagen Finley
does (my query runs a /long time)/ :-). I know I can utilize python to push SELECT results into a array and then run a 'FOR d in dealids' LOOP to feed the FUNCTION parameter but I'd like to learn how to do that with nested SQL statements or FUNCTIONS. Thanks! Hagen On 1

Re: INSERT Trigger to check for existing records

2020-11-22 Thread Hagen Finley
t additional progress I can attain. Very much appreciate your patient assistance here. Best, Hagen On 11/22/20 11:26 AM, Adrian Klaver wrote: On 11/22/20 9:53 AM, Hagen Finley wrote: Hello Michael, Thanks so much for this advice. As I mentioned previously, I'm not very good at this y

RE: INSERT Trigger to check for existing records

2020-11-22 Thread hagen
Thank you Adrian, Your summary looks exactly right to me. I think option 2b looks more in reach for my limited skillset. Let me see if I can make that work (dubious) and report. Best, Hagen -Original Message- From: Adrian Klaver Sent: Sunday, November 22, 2020 11:26 AM To: Hagen

Re: INSERT Trigger to check for existing records

2020-11-22 Thread Hagen Finley
(unique) dealid and that would definitely by an important step forward. I hesitate to admit I have no idea how I would code the "call insert on conflict (unique index) do nothing" syntax, but I would be excited to learn. Best, Hagen On 11/22/20 8:54 AM, Michael Lewis wrote: If you can mod

RE: INSERT Trigger to check for existing records

2020-11-21 Thread hagen
Yes but it didn’t sink in but the two table join idea does make sense – I’ll give that a try. THANK YOU. From: David G. Johnston Sent: Saturday, November 21, 2020 11:25 AM To: Hagen Finley Cc: pgsql-general@lists.postgresql.org Subject: Re: INSERT Trigger to check for existing records

Re: INSERT Trigger to check for existing records

2020-11-21 Thread Hagen Finley
David, That's an interesting idea. I WOULD like  to retain the OLD records that are the same and only INSERT new or changed records. Is there a way to compare the old and the new records without a trigger? Hagen On 11/21/20 9:15 AM, David G. Johnston wrote: On Saturday, November 21,

Re: INSERT Trigger to check for existing records

2020-11-21 Thread Hagen Finley
Thanks so much Adrian, I like this approach but as you indicated it doesn't actually NULL the INSERT. Could we UPDATE the existing record (per my fledgling chk UPDATE and then RETURN NULL? (More proof I don't know what I am talking about ;-). Hagen On 11/21/20 10:11 AM, Adr

INSERT Trigger to check for existing records

2020-11-21 Thread Hagen Finley
t I figure I could use the chk field to delete the new inserts I didn't need. Am I anywhere close (same county) to the right code? Hagen Larimer County, CO