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

SQL/JSON expression generation #55

Open
alvherre opened this issue Mar 30, 2023 · 0 comments
Open

SQL/JSON expression generation #55

alvherre opened this issue Mar 30, 2023 · 0 comments

Comments

@alvherre
Copy link

Hello

There's been some work on adding SQL/JSON features to Postgres, and it would be great to have sqlsmith run through them and see how many problems can be found. However, those features have a bespoke syntax, so I'm afraid the current sqlsmith is not covering all of the new code.

Would it be possible to add support for those features so that we can harden the code more?

Some examples (from the src/test/regress/sql/sqljson.sql file)

SELECT JSON_OBJECT(
    'a': '123',
    1.23 value 123,
    'c': json '[ 1,true,{ } ]',
    'd': jsonb '{ "x" : 123.45 }'
    RETURNING jsonb
);
SELECT JSON_OBJECT('a': JSON_OBJECT('b': 1 RETURNING bytea) FORMAT JSON);
SELECT JSON_OBJECT(1: 1, '2': NULL, '3': 1, 4: NULL, '5': 'a' ABSENT ON NULL WITH UNIQUE RETURNING jsonb);
SELECT JSON_ARRAYAGG(foo ORDER BY bar RETURNING jsonb) FILTER (WHERE bar > 2) FROM
    (VALUES (NULL), (3), (1), (NULL), (NULL), (5), (2), (4), (NULL)) foo(bar);
SELECT JSON_OBJECTAGG(i: ('111' || i)::bytea FORMAT JSON WITH UNIQUE RETURNING text) OVER (PARTITION BY i % 2)
FROM generate_series(1,5) i;

Upcoming patches have extra stuff, such as the IS JSON VALUE expression and more.

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

No branches or pull requests

1 participant