Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kgXwk-0002bj-U4 for pgsql-general@arkaria.postgresql.org; Sat, 21 Nov 2020 18:49:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kgXwj-0003rn-E9 for pgsql-general@arkaria.postgresql.org; Sat, 21 Nov 2020 18:49:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kgXwj-0003rg-6J for pgsql-general@lists.postgresql.org; Sat, 21 Nov 2020 18:49:17 +0000 Received: from p3plsmtpa06-04.prod.phx3.secureserver.net ([173.201.192.105]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kgXwc-0003eG-IT for pgsql-general@lists.postgresql.org; Sat, 21 Nov 2020 18:49:16 +0000 Received: from DESKTOPPBOKT6J ([98.38.100.21]) by :SMTPAUTH: with ESMTPSA id gXwako4cZjBSXgXwakezdV; Sat, 21 Nov 2020 11:49:09 -0700 X-CMAE-Analysis: v=2.4 cv=KbYXDSUD c=1 sm=1 tr=0 ts=5fb96125 a=tZXnaF/PLMojNGgMD7Zm7A==:117 a=tZXnaF/PLMojNGgMD7Zm7A==:17 a=DAwyPP_o2Byb1YXLmDAA:9 a=pGLkceISAAAA:8 a=C-sdMEEzAAAA:8 a=epTmVMiNAAAA:8 a=gxq4_Juiq9q9C-uAjVQA:9 a=QEXdDO2ut3YA:10 a=yMhMjlubAAAA:8 a=SSmOFEACAAAA:8 a=J54KPMtfveJV16amP7cA:9 a=fbXc5tPwS6OijPmg:21 a=gKO2Hq4RSVkA:10 a=UiCQ7L4-1S4A:10 a=hTZeC7Yk6K0A:10 a=frz4AuCg-hUA:10 a=7WAne9lm5b0o3WrbkWlm:22 a=ndEWmUVY6Yapc0oHF_P4:22 X-SECURESERVER-ACCT: hagen@datasundae.com From: To: "'David G. Johnston'" Cc: References: <1fc1fb9e-684f-d028-3f9b-fcfaf1f12f65@aklaver.com> <3e1051a4-98d4-4a59-f382-5b82efa4c095@datasundae.com> In-Reply-To: Subject: RE: INSERT Trigger to check for existing records Date: Sat, 21 Nov 2020 11:49:06 -0700 Message-ID: <000e01d6c036$fda479b0$f8ed6d10$@datasundae.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000F_01D6BFFC.51470140" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQI1vRxzwZPQCHZ4ohRSJ/ouoa4aowLrdCJXAWXtZU8CkAIwLwMR34T1Ak2bFosC2ze7PAHLl6oSqI22ERA= Content-Language: en-us X-CMAE-Envelope: MS4xfC+sXWfmVVbfPH6QemxEUvxGWFCXc7qckHM181/8MaCSRSp6m67uTCYsglBxyL+OUUvLwgSb+p6SGUkkIh77UyM2BL07Vpq0Nmj/RKlHtT0BfRFJFyW+ /JHMVRRGItRT4hne0d3ZnQ06gBn0Ydp8kGaQY+JiB4+X22uwYxKGNJc7KpRX9yGn9YmIjkrVNEsADEE04iYDV6C5wKdKjyePVAEpwIwdUv0L407/YTq/ndtD XFzRKL55obn0NBDzblSFdg== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multipart message in MIME format. ------=_NextPart_000_000F_01D6BFFC.51470140 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yes but it didn=E2=80=99t sink in but the two table join idea does make = sense =E2=80=93 I=E2=80=99ll give that a try. THANK YOU. =20 From: David G. Johnston =20 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 =20 On Saturday, November 21, 2020, David G. Johnston = > 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 a way to = compare the old and the new records without a trigger? =20 A where clause? =20 =20 Did you get the part in the plan where there are two tables, existing = and new? You write queries that join the two tables together and use the = where clause in those queries to limit records. =20 David J. =20 ------=_NextPart_000_000F_01D6BFFC.51470140 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Yes but it didn=E2=80=99t sink = in but the two table join idea does make sense =E2=80=93 I=E2=80=99ll = give that a try. THANK YOU.

 

From: David G. Johnston = <david.g.johnston@gmail.com>
Sent: Saturday, November = 21, 2020 11:25 AM
To: Hagen Finley = <hagen@datasundae.com>
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.johnston@gmail.com= > wrote:

On = Saturday, November 21, 2020, Hagen Finley <hagen@datasundae.com> = 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?

 

 

Did you get the part in the plan where there are two = tables, existing and new? You write queries that join the two tables = together and use the where clause in those queries to limit = records.

 

David J.

 

------=_NextPart_000_000F_01D6BFFC.51470140--