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

Unexpected StringIndexOutOfBoundsException with empty string #3418

Closed
YuanchengJiang opened this issue May 29, 2023 · 0 comments · Fixed by #3427
Closed

Unexpected StringIndexOutOfBoundsException with empty string #3418

YuanchengJiang opened this issue May 29, 2023 · 0 comments · Fixed by #3427
Assignees
Labels
Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution

Comments

@YuanchengJiang
Copy link

YuanchengJiang commented May 29, 2023

Describe the bug

psycopg.OperationalError: consuming input failed: server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.StringLatin1.charAt(StringLatin1.java:48)
	at java.lang.String.charAt(String.java:1513)
	at io.questdb.griffin.ExpressionParser.parseExpr(ExpressionParser.java:286)
	at io.questdb.griffin.SqlParser.expr(SqlParser.java:2190)
	at io.questdb.griffin.SqlParser.parseFromClause(SqlParser.java:1138)
	at io.questdb.griffin.SqlParser.parseDml0(SqlParser.java:921)
	at io.questdb.griffin.SqlParser.parseDml(SqlParser.java:816)
	at io.questdb.griffin.SqlParser.parseSelect(SqlParser.java:1550)
	at io.questdb.griffin.SqlParser.parse(SqlParser.java:2219)
	at io.questdb.griffin.SqlCompiler.compileExecutionModel(SqlCompiler.java:1158)
	at io.questdb.griffin.SqlCompiler.compileUsingModel(SqlCompiler.java:1244)
	at io.questdb.griffin.SqlCompiler.compileInner(SqlCompiler.java:1213)
	at io.questdb.griffin.SqlCompiler.compileBatch(SqlCompiler.java:261)
	at io.questdb.cutlass.pgwire.PGConnectionContext.processQuery(PGConnectionContext.java:2414)
	at io.questdb.cutlass.pgwire.PGConnectionContext.parse(PGConnectionContext.java:1691)
	at io.questdb.cutlass.pgwire.PGConnectionContext.handleClientOperation(PGConnectionContext.java:421)
	at io.questdb.cutlass.pgwire.PGJobContext.handleClientOperation(PGJobContext.java:89)
	at io.questdb.cutlass.pgwire.PGWireServer$1.lambda$$0(PGWireServer.java:91)
	at io.questdb.network.AbstractIODispatcher.processIOQueue(AbstractIODispatcher.java:189)
	at io.questdb.cutlass.pgwire.PGWireServer$1.run(PGWireServer.java:128)
	at io.questdb.mp.Worker.run(Worker.java:118)

To reproduce

Run
select 1 from telemetry where ("")

Note:
It does not stably reproduce the bug but should be reproducible after several tries.

Another case it gave DatabaseError: unbalanced ( which is also weired

Expected Behavior

No response

Environment

- **QuestDB version**: 7.1.3
- **OS**: ubuntu 20.04

Additional context

No response

@YuanchengJiang YuanchengJiang changed the title Unexpected StringIndexOutOfBoundsException with IF clause Unexpected StringIndexOutOfBoundsException with empty string May 29, 2023
@bziobrowski bziobrowski added Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution labels May 29, 2023
@bziobrowski bziobrowski self-assigned this May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants