Skip to content

LIMIT value can be an expression #933

Closed
@SerialVelocity

Description

@SerialVelocity

Describe the bug
LIMIT can also be values such as SELECT ..., '1', etc

To Reproduce
Steps to reproduce the behavior:

  1. Example SQL:
# SELECT * FROM tmp3 LIMIT (SELECT 2);
 order
-------
     1
     2
(2 rows)
# SELECT * FROM tmp3 LIMIT '2';
 order
-------
     1
     2
(2 rows)
  1. JSQLParser exceptions:
    SELECT * FROM tmp3 LIMIT (SELECT 2):
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
    at line 1, column 26.

SELECT * FROM tmp3 LIMIT '2':

Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "\'2\'" <S_CHAR_LITERAL>
    at line 1, column 26.

Expected behavior
For LIMIT to be parsed as an expression

System

  • Database you are using: Postgres
  • Java Version: 11
  • JSqlParser version: 3.1

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions