Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Causing Exception [ia.attnum-1] - this type of expression #378

Closed
ghost opened this issue Jan 3, 2017 · 1 comment
Closed

Causing Exception [ia.attnum-1] - this type of expression #378

ghost opened this issue Jan 3, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 3, 2017

net.sf.jsqlparser.JSQLParserException
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:124)
Caused by:
net.sf.jsqlparser.parser.ParseException: Encountered " <S_QUOTED_IDENTIFIER> "[ia.attnum-1] "" at line 1, column 439.
Was expecting one of:
    <EOF> 
    "FOR" ...
    "GROUP" ...
    "HAVING" ...
    "START" ...
    "CONNECT" ...
    ";" ...
    "(" ...
    "|" ...
    "&" ...
    "^" ...
    "::" ...
    "(" ...
    "(" ...
    "::" ...
    "^" ...
    "|" ...
    "&" ...
    "(" ...
    "START" ...
    "CONNECT" ...
    "GROUP" ...
    "HAVING" ...
    "FOR" ...
    "(" ...
    "(" ...
    "::" ...
    "^" ...
    "|" ...
    "&" ...
    "(" ...
    "(" ...
    "(" ...
    "(" ...
    "::" ...
    "^" ...
    "|" ...
    "&" ...
    "(" ...
    "(" ...
    "(" ...
    
	at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:20535)
	at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:20386)
	at net.sf.jsqlparser.parser.CCJSqlParser.Statements(CCJSqlParser.java:421)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:122)
	

Query Was:

select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class tc, pg_catalog.pg_index i, pg_catalog.pg_namespace n, pg_catalog.pg_class ic where tc.relname = 'business' and n.nspname = 'public' and tc.oid = i.indrelid and n.oid = tc.relnamespace and i.indisprimary = 't' and ia.attrelid = i.indexrelid and ta.attrelid = i.indrelid and ta.attnum = i.indkey[ia.attnum-1] and (not ta.attisdropped) and (not ia.attisdropped) and ic.oid = i.indexrelid order by ia.attnum

@wumpz
Copy link
Member

wumpz commented Jan 4, 2017

Unfortunately JSqlParser supports only numerical array indexes. Some DBMS using brackets to enclose object names
select [a]
JSqlParser supports this. You see both scenarios are overlapping without a clean separation.

@wumpz wumpz closed this as completed in 7a13344 Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant