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 Finley
Hello Michael, Thanks so much for this advice. As I mentioned previously, I'm not very good at this yet, so forgive me if my response is obtuse. I really love databases but my sentiments may be unrequited. In reality my table has lots of columns (~30) including a report date (repdate) and ea

Re: INSERT Trigger to check for existing records

2020-11-21 Thread Hagen Finley
2020, Hagen Finley <mailto:ha...@datasundae.com>> wrote: I pull a new forecast spreadsheet each Monday. 80% of the records are the same as the existing records from the week before. Here’s what I (REALLY) want: Trigger looks at three fields prior to new insert: Deal I

Re: INSERT Trigger to check for existing records

2020-11-21 Thread Hagen Finley
ian Klaver wrote: On 11/21/20 8:47 AM, Adrian Klaver wrote: On 11/21/20 8:20 AM, Adrian Klaver wrote: On 11/21/20 8:00 AM, Hagen Finley wrote: Hello, Instead: IF NEW.ndealid = OLD.ndealid AND NEW.revusd = OLD.revusd AND NEW.stage = OLD.stage THEN  RETURN NULL; --Will cancel I

INSERT Trigger to check for existing records

2020-11-21 Thread Hagen Finley
Hello, I am definitely out over my skis here so I’ll apologize in advance 😉. Running version 12.5-1.pgdg20.04+1 on ubuntu. It’s essentially a personal database I use to ingest sales forecast spreadsheets from which I  create custom reports for my job function. I pull a new forecast spreadshe