Skip to content

Unable to parse Postgres query with json_object function #1371

Closed
@SerialVelocity

Description

@SerialVelocity

Describe the bug
Since 4.2, queries fail to parse that use the built-in Postgres functions. Looks like this was caused by #1263.

To Reproduce
Steps to reproduce the behavior:

  1. Example SQL
SELECT json_object('{a, 1, b, 2}');
SELECT json_object('{{a, 1}, {b, 2}}');
SELECT json_object('{a, b}', '{1,2 }');

SELECT * FROM json_object('{a, 1, b, 2}');
SELECT * FROM json_object('{{a, 1}, {b, 2}}');
SELECT * FROM json_object('{a, b}', '{1,2 }');
  1. Parsing this SQL using JSqlParser with these statements
  2. Exception
Encountered unexpected token: "json_object" "JSON_OBJECT"

Expected behavior
The queries to parse as a function. This is a new bug as it used to work in 4.1

System

  • Database you are using Postgres
  • Java Version 11
  • JSqlParser version 4.1 / 4.2

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions