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

Also fuzz test the JSONB code #8

Merged
merged 2 commits into from
Jun 15, 2024
Merged

Also fuzz test the JSONB code #8

merged 2 commits into from
Jun 15, 2024

Conversation

erikdubbelboer
Copy link
Member

Before this we only fuzz tested the code on normal table columns. But with the code for the normal columns and jsonb fields getting some differences it's good to test both.

Before this we only fuzz tested the code on normal table columns. But
with the code for the normal columns and jsonb fields getting some
differences it's good to test both.
conditions, _, err := c.Convert([]byte(in), 1)
if err == nil && conditions != "" {
j, err := pg_query.ParseToJSON("SELECT * FROM test WHERE 1 AND " + conditions)
if err != nil {
t.Fatalf("%q %q %v", in, conditions, err)
}

t.Log(j)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to keep this log statement in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's very useful to see the generated AST when an input fails. It doesn't print anything for the cases that don't fail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if it would output with -v, but it does not. 👍

@erikdubbelboer erikdubbelboer enabled auto-merge (squash) June 15, 2024 08:19
@erikdubbelboer erikdubbelboer merged commit 6348ca9 into main Jun 15, 2024
5 checks passed
@erikdubbelboer erikdubbelboer deleted the fuzz-jsonb branch June 15, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants