public inbox for [email protected]  
help / color / mirror / Atom feed
A function to find errors in groups in a table
5+ messages / 2 participants
[nested] [flat]

* A function to find errors in groups in a table
@ 2022-06-09 13:37  Shaozhong SHI <[email protected]>
  0 siblings, 2 replies; 5+ messages in thread

From: Shaozhong SHI @ 2022-06-09 13:37 UTC (permalink / raw)
  To: pgsql-sql <[email protected]>

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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* A function to find errors in groups in a table
@ 2022-06-09 13:37  Shaozhong SHI <[email protected]>
  parent: Shaozhong SHI <[email protected]>
  1 sibling, 0 replies; 5+ messages in thread

From: Shaozhong SHI @ 2022-06-09 13:37 UTC (permalink / raw)
  To: Pgsql-general <[email protected]>

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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: A function to find errors in groups in a table
@ 2022-06-09 19:16  Steve Midgley <[email protected]>
  parent: Shaozhong SHI <[email protected]>
  1 sibling, 1 reply; 5+ messages in thread

From: Steve Midgley @ 2022-06-09 19:16 UTC (permalink / raw)
  To: Shaozhong SHI <[email protected]>; +Cc: pgsql-sql <[email protected]>

On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI <[email protected]> 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?

Thanks for clarifying your problem,
Steve


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: A function to find errors in groups in a table
@ 2022-06-09 23:13  Shaozhong SHI <[email protected]>
  parent: Steve Midgley <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Shaozhong SHI @ 2022-06-09 23:13 UTC (permalink / raw)
  To: Steve Midgley <[email protected]>; +Cc: pgsql-sql <[email protected]>

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 <[email protected]> wrote:

>
>
> On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI <[email protected]>
> 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?
>
> Thanks for clarifying your problem,
> Steve
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: A function to find errors in groups in a table
@ 2022-06-09 23:25  Steve Midgley <[email protected]>
  parent: Shaozhong SHI <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Steve Midgley @ 2022-06-09 23:25 UTC (permalink / raw)
  To: Shaozhong SHI <[email protected]>; +Cc: pgsql-sql <[email protected]>

On Thu, Jun 9, 2022 at 4:13 PM Shaozhong SHI <[email protected]> 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 <[email protected]> wrote:
>
>>
>>
>> On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI <[email protected]>
>> 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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2022-06-09 23:25 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 13:37 A function to find errors in groups in a table Shaozhong SHI <[email protected]>
2022-06-09 13:37 ` Shaozhong SHI <[email protected]>
2022-06-09 19:16 ` Steve Midgley <[email protected]>
2022-06-09 23:13   ` Shaozhong SHI <[email protected]>
2022-06-09 23:25     ` Steve Midgley <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox