Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[BUG] JSQLParser 5.4-SNAPSHOT : PostgreSQL : Custom type casting with more than one level not working #2341

Open
@tomershay

Description

It seems that the parser supports single-level composite types but fails on nested multi-level composite types.

Query to reproduce the parsing error:

SELECT
 (product_data::product_info_similarity).info.category AS category,
 COUNT(*) AS num_products
FROM products
GROUP BY (product_data::product_info_similarity).info.category;

Error:

Image

Generating types/tables to run the query in a real DB:

CREATE TYPE product_info AS (
 name text,
 category text
);
CREATE TYPE product_info_similarity AS (
 info product_info
);
CREATE TABLE products (
 id serial PRIMARY KEY,
 product_data product_info_similarity
);
INSERT INTO products (product_data)
VALUES
 (ROW(ROW('Laptop', 'Electronics'))::product_info_similarity),
 (ROW(ROW('Chair', 'Furniture'))::product_info_similarity),
 (ROW(ROW('Table', 'Furniture'))::product_info_similarity);
SELECT
 (product_data::product_info_similarity).info.category AS category,
 COUNT(*) AS num_products
FROM products
GROUP BY (product_data::product_info_similarity).info.category;

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /