Skip to content

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
@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