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

Support expressions with ":". #1134

Closed
LonwoLonwo opened this issue Mar 19, 2021 · 6 comments
Closed

Support expressions with ":". #1134

LonwoLonwo opened this issue Mar 19, 2021 · 6 comments

Comments

@LonwoLonwo
Copy link

LonwoLonwo commented Mar 19, 2021

Describe the bug
Some Databases, like Informix, have a sign ":" as delimiter name of the database and schema name.
https://www.ibm.com/support/knowledgecenter/en/SSGU8G_14.1.0/com.ibm.sqls.doc/ids_sqs_1652.htm
This is not a completely accurate link, but here the use of a colon is mentioned.

To Reproduce
Steps to reproduce the behavior:
use "SELECT * FROM stores_demo:informix.accounts;" with Informix database and get

net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: ":" ":"
    at line 2, column 17.
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:26538)
	at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:26377)
	at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:91)

dbeaver/dbeaver#11590

Expected behavior
Please add colon support as a separator between the database name and the schema name.

System

  • Informix Dynamic Server 14.10.FC4W1
  • jsqlparser:4.0
wumpz added a commit that referenced this issue Mar 20, 2021
@wumpz
Copy link
Member

wumpz commented Mar 20, 2021

I kind of introduced this parsing half way. Now you are able to parse it, but the deparser is not there. Producing the source SQL results in the point way again.

@wumpz
Copy link
Member

wumpz commented Mar 25, 2021

@LonwoLonwo Does it work?

@LonwoLonwo
Copy link
Author

Hello, @wumpz
Sorry for late response.
Yes, it works for parsing.
I don't now your workflow, so I just say - ticket can be closed.

@manticore-projects
Copy link
Contributor

Closed on behalf of the author.

@manticore-projects
Copy link
Contributor

@LonwoLonwo

we are facing a problem here: in any modern RDBMS : is a Json Operator for EXTRACT FROM PATH e. g.:

-- DataBricks/Snowflake
SELECT c1:price j
    FROM VALUES('{ "price": 5 }') AS T(c1);

-- Postgres
SELECT c1::JSON -> 'price' j
    FROM VALUES('{ "price": 5 }') AS T(c1);

It is impossible to support both at the same time, but we could apply a Configuration Switch, e. g. an INFORMIX mode for you.
I definitely need this JSON support, but I also want to support your needs -- so please make a wish on what would be the best way forward on this rather exotic feature.

@manticore-projects
Copy link
Contributor

I have solved it by allowing : for Table names only, while : will return a JSOnExpression everywhere else.

manticore-projects added a commit that referenced this issue Nov 16, 2024
- `:` is allowed as delimiter in table names (for INFORMIX)
- otherwise `:` will return a JSON expression and can't be used as column delimiter
- see #1134 and #2001

Signed-off-by: Andreas Reichel <andreas@manticore-projects.com>
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

3 participants