Skip to content

Use jsonb_array_elements_text instead of trim? #876

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

Open
e-gineer opened this issue Apr 4, 2025 · 0 comments · May be fixed by #888
Open

Use jsonb_array_elements_text instead of trim? #876

e-gineer opened this issue Apr 4, 2025 · 0 comments · May be fixed by #888
Assignees
Labels
bug Something isn't working

Comments

@e-gineer
Copy link
Contributor

e-gineer commented Apr 4, 2025

For this code:

with bucket_list as (
select
trim(b::text, '"' ) as bucket_name
from
aws_macie2_classification_job,
jsonb_array_elements(s3_job_definition -> 'BucketDefinitions') as d,
jsonb_array_elements(d -> 'Buckets') as b
)

We should use jsonb_array_elements_text instead of trim?

with bucket_list as (
  select
    jsonb_array_elements_text(d -> 'Buckets') as bucket_name
  from
    aws_macie2_classification_job,
    jsonb_array_elements(s3_job_definition -> 'BucketDefinitions') as d
)

This change should achieve the same result without using the trim function.

The implicit use of s3_job_definition is also confusing and could be improved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants