Skip to content

[BUG] JSQLParser : PostgreSQL : SELECT without target expressions fails to parse #2784

Closed

Description

@tomershay88

PostgreSQL permits SELECT FROM ... with no target expressions. It produces rows with zero output columns. See the PostgreSQL SELECT documentation.

JSQLParser fails to parse this syntax when the SELECT is used as a derived table.

SQL Example

SELECT count(*)
FROM (
    SELECT
    FROM (VALUES
        (1, 'alpha'),
        (2, 'beta'),
        (3, 'gamma')
    ) AS t(id, label)
) AS q;

This query executes successfully in PostgreSQL and returns: 3

Parsing error

JSQLParser throws:

ParseException: Encountered: <OPENING_BRACKET> / "(", at line 2, column 6, in lexical state DEFAULT.
Was expecting this terminal within expansion starting at n/a:
    <K_LATERAL> (inside 8769:9) ...

The reported ( begins the derived table. The PostgreSQL syntax JSQLParser needs to handle is the inner SELECT immediately followed by FROM, with no target expressions.

Tested with JSQLParser 5.4-SNAPSHOT.

Activity

  1. manticore-projects commented on Oct 13, 2026

    @manticore-projects
    Contributor

    I am sorry for asking bluntly: do we really want to support just anything or should we ask ourselves first "Why is it there and what value does it add"?

  2. added a commit that references this issue on Oct 21, 2026
    cb0af75
  3. added a commit that references this issue on Oct 22, 2026
    28ad7d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions