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 1pQA2R-0000lM-9q for pgsql-sql@arkaria.postgresql.org; Thu, 09 Feb 2023 16:44:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQA2P-00064g-Mm for pgsql-sql@arkaria.postgresql.org; Thu, 09 Feb 2023 16:44:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQA2P-00064U-Bo for pgsql-sql@lists.postgresql.org; Thu, 09 Feb 2023 16:44:45 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pQA2N-0005je-7E for pgsql-sql@lists.postgresql.org; Thu, 09 Feb 2023 16:44:44 +0000 Received: by mail-ej1-x62a.google.com with SMTP id c26so3377005ejz.10 for ; Thu, 09 Feb 2023 08:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YFqZ/1ksZRQ0ojsjQOhanG/ATqr/oeUnoGs+SCmxnzA=; b=UtonjhpiEzqE/84VlA1FTsJ6rbCwQUMmkEdWiK8vsW2L5ntQZaEC6xOQrs8PnZDFLp /QXfdfzIJ0wDcTeJjTy+lSwEfWqXXT1/LLQhHuqOKTLwvnuj32DFQGIz/LzYJrZpCN/M fC9F117dHL1y15Z2EUA4LK/d5/Rts+9XvfB/IISYzZQegAGHHT31bHTvvW4vrk6giibx UVlcPtUYVNHPBVg3tAgAcDUaR5H84bumau5ix77v1pSvB3FsBSw9a7BasNQOgL5yqTLB Jy+N7C1sKn+PUm2xpKS5bbX2/OEJ+w9bhR45Hwez5Alji05FNFfyi/3sa24XP2R3uUny yhpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YFqZ/1ksZRQ0ojsjQOhanG/ATqr/oeUnoGs+SCmxnzA=; b=U6IdgjLllJZ20geHeBUtxEUJci8w6afGqGTG9XnJfcrxv/xfDE4YRKd8IrFyKKF5vU vHXEMz3/M+lIDAOHOedU34k5GyXHpEdS4K1/nON+2pOi5SNjz9XXH0SCw+a/Vh9LB1T6 rKDKgzm/IbRzJLvfEgx7GDOTKbN+iT2/fkxEcK1EZ3OlYDguTRxf/k/GS09tofrRpJWI eIteK27oQVlVTz94w0CJ3dNvkGs01HZ2BN3ZqB/U3KtqET0Qkmr5zfSjxH1HPUfaPB2G feAEFDKSha+eO+rf1dhSaMh26OaEK7AJNb5I7vaG0ATb6+ewtY1UieT/JQop1H5e9ycK 9j0A== X-Gm-Message-State: AO0yUKUjdSRhAOdBZUWngFH/FhLNHxj79vHsoQO7z0j8CL1tMw8Lx8bg abPWmJdvzkkQva/kRmClj0h9zzDWi5ziaZ3o1uA= X-Google-Smtp-Source: AK7set9UAtujE8AZ8jYonMN2k24PMeKodFw4ylu6uWsoH0HkNy5mN1xW9PIaE40zCdGnvU9u0yfe47o3R0v2HKRHZaY= X-Received: by 2002:a17:906:308a:b0:878:7d06:44b1 with SMTP id 10-20020a170906308a00b008787d0644b1mr677085ejv.1.1675961081325; Thu, 09 Feb 2023 08:44:41 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "David G. Johnston" Date: Thu, 9 Feb 2023 09:44:25 -0700 Message-ID: Subject: Re: How to ensure a log-entry is created based on state of data in other tables To: Andreas Joseph Krogh Cc: pgsql-sql@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000e8ed8205f447180a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e8ed8205f447180a Content-Type: text/plain; charset="UTF-8" On Thu, Feb 9, 2023 at 12:24 AM Andreas Joseph Krogh wrote: > Is there a better way, using some extra tables to do bookkeeping can the > have constraints ensuring this business-requirement? > > > Every time an activity newly becomes "Not Done" increment a "not done seen counter" and likewise with a "done seen counter". Whenever the former is greater than the later you have one or more not done activities. David J. --000000000000e8ed8205f447180a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Feb 9, 2023 at 12:24 AM Andreas Joseph Krogh <<= a href=3D"mailto:andreas@visena.com">andreas@visena.com> wrote:

Is there a better way, using some extra tables to do= bookkeeping can the have constraints ensuring this business-requirement?



Every time an activity newl= y becomes "Not Done" increment a "not done seen counter"= ; and likewise with a "done seen counter".=C2=A0 Whenever the for= mer is greater than the later you have one or more not done activities.

David J.

--000000000000e8ed8205f447180a--