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 1nzRY9-0000hv-NL for pgsql-sql@arkaria.postgresql.org; Thu, 09 Jun 2022 23:26:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nzRX9-0003XT-De for pgsql-sql@arkaria.postgresql.org; Thu, 09 Jun 2022 23:25:47 +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 1nzRX9-0003XK-1l for pgsql-sql@lists.postgresql.org; Thu, 09 Jun 2022 23:25:47 +0000 Received: from premium22-2.web-hosting.com ([68.65.122.104]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nzRX5-0006wq-Rv for pgsql-sql@lists.postgresql.org; Thu, 09 Jun 2022 23:25:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=misuse.org; s=default; h=Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version: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=JvmHiiidCFFiRpbE5L4PeaxpERoZOWwPjbuycLflLqw=; b=cKoXEnmxMg5JO1GeD0T1WNM4Z8 xCCsW/Mjz9EXv+8P+e6sagt5H2KP2EBSFiUeZR2annnwsrIHZsjtc2pFsp/KaYuWopb2J0gKEVG9g sllu7f+2suYq+GvY7UZx3DCtvKcdaBYCAqlykTjhFziQqTyiLmHw52gbn06ujNmCQfFE5nQVyXBnj dLCFDvKPHI5msas0tmIgN9CY8hLxSYwJcU6goPXGhQgmppmtxaSVuQXynN66d2ivrgpS0lMV8mEeG Bekop1UV1u3knQDehkJedYHDcR4tKDU9PDI2MF0TLOQVyWXPzqqzRb5+6xK2+JGHxoLQx5BxQANvK DSv0xYgA==; Received: from mail-pj1-f53.google.com ([209.85.216.53]:45905) by premium22.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.95) (envelope-from ) id 1nzRWy-00DULC-M5 for pgsql-sql@lists.postgresql.org; Thu, 09 Jun 2022 19:25:41 -0400 Received: by mail-pj1-f53.google.com with SMTP id w2-20020a17090ac98200b001e0519fe5a8so671296pjt.4 for ; Thu, 09 Jun 2022 16:25:36 -0700 (PDT) X-Gm-Message-State: AOAM532uMibHPSW5vf5ncStfA7c5GRfiXOPCYIPpnSA9OoemYQY2UZ1g EypKfsDM52twfWHXp7b2hnoGyl8ptvVV5eOpDo8= X-Google-Smtp-Source: ABdhPJzV487tdtReP0UpHwnX6oheIrcjbLByubumeLaTpMz4/tVPKu60eq/kL5nURIiURaILInBK+P5AI8EWeCX/QuM= X-Received: by 2002:a17:902:da87:b0:166:423d:f3be with SMTP id j7-20020a170902da8700b00166423df3bemr40148199plx.150.1654817135862; Thu, 09 Jun 2022 16:25:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Steve Midgley Date: Thu, 9 Jun 2022 16:25:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: A function to find errors in groups in a table To: Shaozhong SHI Cc: pgsql-sql Content-Type: multipart/alternative; boundary="0000000000008d2df105e10c23a7" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - premium22.web-hosting.com X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - misuse.org X-Get-Message-Sender-Via: premium22.web-hosting.com: authenticated_id: science@misuse.org X-Authenticated-Sender: premium22.web-hosting.com: science@misuse.org X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008d2df105e10c23a7 Content-Type: text/plain; charset="UTF-8" On Thu, Jun 9, 2022 at 4:13 PM Shaozhong SHI wrote: > The first two can be regarded right. Certainly, the last one must be > wrong. How can a primary flow get into a secondary flow? > > That is odd. > > Regards, > > David > > On Thursday, 9 June 2022, Steve Midgley wrote: > >> >> >> On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI >> wrote: >> >>> There is a table full of grouped values like the following >>> >>> nodeid link_type primary >>> 11 outflowlink 1 >>> 11 inflowlink 1 >>> 11 outflowlink 2 >>> >>> Primary of 1 indicates a primary water course. Primary of 2 indicates a >>> secondary water course. >>> >>> Obviously, one of the out flow links is an error, as its primacy value >>> is 2. It is wrong that water flows from a primary water course into a >>> secondary water course. >>> >>> How can a function can be designed to find and report such errors? >>> >> >> Is the problem that there exists this row: >> >> 11 outflowlink 2 >> >> But there is no corresponding row: >> >> 11 inflowlink 2 >> >> So that you need to find all "orphan" rows that don't have a >> corresponding member with the opposing data field inflowlink or >> outflowlink where the "primary" column is the join field between the two >> rows? >> > You didn't answer my question, at least in a way I can understand, which makes it hard to give you useful input on a solution.. Also, please try to bottom post. This list asks posters to reply at the bottom of each email. Steve --0000000000008d2df105e10c23a7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Jun 9, 2022 at 4:13 PM Shaozh= ong SHI <shishaozhong@gmail.co= m> wrote:
The first two can be regarded right.=C2=A0 Certainly, the last one must be= wrong.=C2=A0 How can a primary flow get into a secondary flow?

That is odd.

Regards,

=
David

On Thursday, 9 June 2022, Steve Midgley <science@misuse.org> wrote= :


On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI = <shishaozhon= g@gmail.com> wrote:
There is a table full of grouped values like the followin= g

nodeid=C2= =A0 =C2=A0 =C2=A0link_type=C2=A0 =C2=A0 =C2=A0 primary
11=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0outflowlink=C2=A0 =C2=A0 =C2=A0 =C2= =A01
11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 inflowlin= k=C2=A0 =C2=A0 =C2=A0 1
11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 outflowlink=C2=A0 =C2=A0 =C2=A02

= Primary of 1 indicates a primary water course.=C2=A0 Primary of 2 indicates= a secondary water course.

Obviously, one of the o= ut flow links is an error, as its primacy value is 2.=C2=A0 It is wrong tha= t water flows from a primary water course into a secondary water course.

How can a function can be designed to find and repor= t such errors?

Is = the problem that there exists this row:

11=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 outflowlink=C2= =A0 =C2=A0 =C2=A02

But there is no corr= esponding row:

11=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 inflowlink=C2=A0 =C2=A0 =C2=A02= =C2=A0=C2=A0

So that you need to find all &= quot;orphan" rows that don't have a corresponding member with the = opposing data field inflowlink or outflowlink=C2=A0where the "primary&= quot; column is the join field between the two rows?

You didn't answer my que= stion, at least in a way I can understand, which makes it hard to give you = useful input on a solution.. Also, please try to bottom post. This list ask= s posters to reply at the bottom of each email.

St= eve=C2=A0
--0000000000008d2df105e10c23a7--