A function to find errors in groups in a table

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: A function to find errors in groups in a table
Date: 2022-06-09 13:37:27
Message-ID: CA+i5JwZCt0c1V-LexLo50Oa+r_UVLM26ZQ4pqq2d9XYaBebKjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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?

Regards,

David

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shaozhong SHI 2022-06-09 13:37:54 A function to find errors in groups in a table
Previous Message houzj.fnst@fujitsu.com 2022-06-09 11:43:51 RE: Support logical replication of DDLs

Browse pgsql-sql by date

  From Date Subject
Next Message Shaozhong SHI 2022-06-09 13:37:54 A function to find errors in groups in a table
Previous Message Joe Conway 2022-06-08 14:15:58 Re: Electricity bill