Skip to content

"select distinct arn ..." (and similar) should be "select distinct on (arn) arn ..." #493

@e-gineer

Description

@e-gineer

Many queries in this mod use distinct to prevent duplicates. For example:

select
-- Required columns
distinct arn as resource,

Distinct checks all elements in the tuple (row), as opposed to ensuring the specific arn or name (common ones) is actually distinct.

So, queries like this:

select
  distinct arn as resource,

should actually be:

select distinct on (arn)
  arn,

A an example to see the difference, please try these two queries:

select distinct region, name from aws_s3_bucket order by region, name;

select distinct on (region) region, name from aws_s3_bucket order by region, name;

Metadata

Metadata

Labels

bugSomething isn't workinghelp wantedWe are asking the community to submit a PR to resolve this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions