Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
e-gineer opened this issue Aug 26, 2022 · 3 comments
Assignees
Labels
bug Something isn't working help wanted We are asking the community to submit a PR to resolve this issue

Comments

@e-gineer
Copy link
Contributor

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;
@e-gineer e-gineer added bug Something isn't working help wanted We are asking the community to submit a PR to resolve this issue labels Aug 26, 2022
@github-actions
Copy link

'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.'

@github-actions github-actions bot added the stale No recent activity has been detected on this issue/PR and it will be closed label Dec 14, 2022
@github-actions
Copy link

'This issue was closed because it has been stalled for 90 days with no activity.'

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2023
@misraved misraved reopened this Jan 15, 2023
@github-actions github-actions bot removed the stale No recent activity has been detected on this issue/PR and it will be closed label Jan 15, 2023
@github-actions
Copy link

'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.'

@github-actions github-actions bot added the stale No recent activity has been detected on this issue/PR and it will be closed label Apr 24, 2023
@cbruno10 cbruno10 removed the stale No recent activity has been detected on this issue/PR and it will be closed label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted We are asking the community to submit a PR to resolve this issue
Projects
None yet
5 participants