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 1pQ9rJ-0000OE-Gj for pgsql-sql@arkaria.postgresql.org; Thu, 09 Feb 2023 16:33:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQ9rI-0006j4-Ak for pgsql-sql@arkaria.postgresql.org; Thu, 09 Feb 2023 16:33:16 +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 1pQ9rH-0006iv-NZ for pgsql-sql@lists.postgresql.org; Thu, 09 Feb 2023 16:33:16 +0000 Received: from outbound.visena.net ([46.226.12.34]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQ9rE-00041Q-Dl for pgsql-sql@lists.postgresql.org; Thu, 09 Feb 2023 16:33:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=visena.com; s=20141101.wh; h=Content-Type:MIME-Version:Subject:References:In-Reply-To: Message-ID:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Wu/m6D4bVhfTbC7E+ORFfV6LhAXTXgnRKTIBBc4cGRo=; b=UyWzQxXmLSX0vRVIBRCy2Y0bzc Cve+ko2SNCktGcoCd3XEXP3g1wtDRc9jyTVxAQwPqWsgfE/r3Y5SAacf+TQqM/IinqXdzeAJmCuTA sDe6OSMo5m/S2lq3PIhx6wriqUHmSC7yn/qn6d+ego249MA+qKYz0WRESvEMEa6iH/WM=; Received: from batch01.services.internal.visena.net ([10.3.0.103]) by outbound.visena.net with utf8esmtp (Exim 4.93) (envelope-from ) id 1pQ9r9-005tbS-VE; Thu, 09 Feb 2023 17:33:07 +0100 Date: Thu, 9 Feb 2023 17:33:07 +0100 (CET) From: Andreas Joseph Krogh To: Steve Midgley Cc: pgsql-sql@lists.postgresql.org Message-ID: In-Reply-To: References: Subject: Re: How to ensure a log-entry is created based on state of data in other tables MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_616231_1002788931.1675960387868" X-Mailer: Visena Mail 3.2.302 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_616231_1002788931.1675960387868 Content-Type: multipart/related; boundary="----=_Part_616232_36218552.1675960387868" ------=_Part_616232_36218552.1675960387868 Content-Type: multipart/alternative; boundary="----=_Part_616233_508783082.1675960387889" ------=_Part_616233_508783082.1675960387889 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable P=C3=A5 torsdag 09. februar 2023 kl. 16:08:16, skrev Steve Midgley < science@misuse.org >: [=E2=80=A6] What is the time window required for "DONE" and "NOT_DONE" to be correct? D= o=20 they need to be atomic (meaning the time window is effectively 0)? Or can t= he=20 system "notice" recent changes and keep track of done/not done after-the-fa= ct?=20 If your time window is > 0, it seems like recurring processes could be set = up=20 to track DONE / NOT_DONE? Another totally different way to think about this is to create a view that= =20 provides answers on DONE and NOT_DONE as computed values based on the=20 underlying state of the table at the time the view is queried? That would s= eem=20 to satisfy a time window of 0? Steve=20 Yes, they need to be atomic. Either all are DONE and there is an entry in= =20 activity_product_log for product_id, or there is no entry in=20 activity_product_log. -- Andreas Joseph Krogh CTO / Partner - Visena AS Mobile: +47 909 56 963 andreas@visena.com www.visena.com ------=_Part_616233_508783082.1675960387889 Content-Type: text/html;charset=UTF-8 Content-Transfer-Encoding: quoted-printable
P=C3=A5= torsdag 09. februar 2023 kl. 16:08:16, skrev Steve Midgley <science@misuse.org>:
=

[=E2=80=A6]

=C2= =A0

What is the time window required for "D= ONE" and "NOT_DONE" to be correct? Do they need to be atomic= (meaning the time window is effectively 0)? Or can the system "notice= " recent changes and keep track of done/not done after-the-fact? If yo= ur time window is > 0, it seems like recurring processes could be set up= to track DONE / NOT_DONE?
=C2=A0
Another totally diffe= rent way to think about this is to create a view that provides answers on D= ONE and NOT_DONE as computed values based on the underlying state of the ta= ble at the time the view is queried? That would seem to satisfy a time wind= ow of 0?
=C2=A0
Steve=C2=A0

Yes, they need to be atomic. Either all are DO= NE and there is an entry in activity_product_log for product_id, or there is no entry in activity_produc= t_log.

=C2=A0

--
Andreas Josep= h Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
<= div>andreas@visena.com
3D""
=C2=A0
------=_Part_616233_508783082.1675960387889-- ------=_Part_616232_36218552.1675960387868-- ------=_Part_616231_1002788931.1675960387868--