Skip to content

[BUG] JSQLParser 5.4-SNAPSHOT : PostgreSQL : json_populate_record row expansion with (…). * not supported #2412

@tomershay

Description

@tomershay

Failing SQL Feature

Row expansion from a composite value using (expression).*.

In PostgreSQL, functions like json_populate_record return a composite record, and (record_expression).* expands it into individual columns. This syntax is commonly used when inserting JSON data into typed tables.

Docs here

SQL Example

CREATE TABLE users (
    id int,
    name text,
    age int
);

CREATE TABLE staging_users (
    data json
);

INSERT INTO staging_users VALUES
('{"id":1,"name":"Alice","age":30}'),
('{"id":2,"name":"Bob","age":25}');

INSERT INTO users
SELECT (json_populate_record(NULL::users, data)).*
FROM staging_users;

Parsing Error

ParseException: Encountered: "." / ".", at line 2, column 49, in lexical state DEFAULT. Was expecting one of these terminals within expansion starting at 1347:23:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions