Closed
Description
Actual Behavior
In PostgreSQL I have a view that one of the columns is the result of a query, and then converts it into an array, and then into a String:
SELECT p.id,
pt.name,
array_to_string(
array(
select pc.name
from product_category pc
), ','
) AS categories
FROM product p;
The problem is the parameter of the 'array' function that is a query. If this parameter was for example an String, it works fine:
SELECT p.id,
pt.name,
array_to_string(
array(
'abc', 'def'
), ','
) AS categories
FROM product p;
Expected Behavior
The expected behavior is that the parser treats this parameter as an Statement of type Select
Steps to Reproduce the Problem
- Try to parse the given select
- The parser throws the exception:
net.sf.jsqlparser.JSQLParserException
at net.sf.jsqlparser.parser.CCJSqlParserManager.parse(CCJSqlParserManager.java:40)
at es.prodevelop.pui.model.db.ViewsAnalysis.init(ViewsAnalysis.java:130)
at es.prodevelop.pui.model.db.ViewsAnalysis.access$0(ViewsAnalysis.java:99)
at es.prodevelop.pui.model.db.ViewsAnalysis$1.run(ViewsAnalysis.java:90)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered " "(" "( "" at line 3, column 17.
Was expecting one of:
<EOF>
"AS" ...
"DO" ...
"ANY" ...
- Change the Select parameter into an String parameter, and try again, and it will work.
Specifications
- Version: 1.1
- Platform: Linux
- Subsystem: Unbuntu 16.04
Metadata
Metadata
Assignees
Labels
No labels