On 11/25/20 9:13 AM, Adrian Klaver wrote:
On 11/25/20 8:43 AM, ha...@datasundae.com wrote:
Adrian,
Until the previous questions are addressed the above is not doable.
3. Not positive the IF is doing what I want, but if I copy a
sfdc.dealid into the same_test() parameter field the FUNTI
[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
e status too.
Before continuing with the function I would try some SELECT functions
that do what you want.
Does that articulate the thought process adequately?
Best,
Hagen
-Original Message-
From: Adrian Klaver
Sent: Wednesday, November 25, 2020 9:07 AM
To: Hagen Finley ; pgsql-gen
laver
Sent: Wednesday, November 25, 2020 9:07 AM
To: Hagen Finley ; 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 7:41 AM, Hagen Finley wrote:
> Folks,
>
> Just a quick questi
On 11/25/20 7:41 AM, Hagen Finley wrote:
Folks,
Just a quick question. *Using this FUNCTION:*
CREATE OR REPLACE FUNCTION same_test(did numeric)
RETURNS numeric AS $$
BEGIN
IF $1 IN
(SELECT dealid from hygiene_112)
THEN
UPDATE hygiene_119 SET paid =
Folks,
Just a quick question. *Using this FUNCTION:*
CREATE OR REPLACE FUNCTION same_test(did numeric)
RETURNS numeric AS $$
BEGIN
IF $1 IN
(SELECT dealid from hygiene_112)
THEN
UPDATE hygiene_119 SET paid = 'SAME';
ELSE
UPDATE hygiene_119 S
Adrian and Michael,
My current insert logic (which works) is in a psycopg2 python script
which reads a spreadsheet row into an array, so for the moment I didn't
want to add that integration to my struggle.
cur = conn.cursor()
\
query = "INSERT INTO
sfdc(theater,co
Finley ; pgsql-general@lists.postgresql.org
Subject: Re: INSERT Trigger to check for existing records
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 yet, so forgive me if my resp
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 yet, so forgive me if my response is obtuse. I really love
databases but my sentiments may be unrequited.
The overriding issue is lack of a plan. From
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
If you can modify your insert statement, and live with an extra column in
the data, no trigger is needed as best I can figure.
Create a unique index over the existing columns, add a "created_on" field
and call insert on conflict (unique index) do nothing.
This should give the behavior you want.
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
On Saturday, November 21, 2020, David G. Johnston <
david.g.johns...@gmail.com> wrote:
> On Saturday, November 21, 2020, Hagen Finley wrote:
>
>> 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
On Saturday, November 21, 2020, Hagen Finley wrote:
> 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?
>
A where clause?
David J.
On 11/21/20 9:47 AM, Hagen Finley wrote:
Thanks so much Adrian,
I like this approach but as you indicated it doesn't actually NULL the
INSERT.
It should cause the INSERT not to happen if a row exists with the same
values for ndealid, revusd and stage. Are you seeing an INSERT for those
cond
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, 2020,
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, Adrian Klaver wrot
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 INSERT
ELSE
RET
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 INSERT
ELSE
RETURN NEW;
END IF;
Well this is what happe
On 11/21/20 8:00 AM, Hagen Finley wrote:
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 f
On Saturday, November 21, 2020, Hagen Finley 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 ID (numeric),
> reven
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
22 matches
Mail list logo