Skip to content

Improved usability of error log messages in web console #49

Description

@marregui

Is your feature request related to a problem?

No response

Describe the solution you'd like.

Given this setup:

CREATE TABLE hits (
    id string,
    url string,
    timestamp timestamp
) timestamp(timestamp);

INSERT INTO hits VALUES (rnd_str(36, 36, 0), 'https://questdb.io/, systimestamp());
INSERT INTO hits VALUES (rnd_str(36, 36, 0), 'https://questdb.io', systimestamp());
INSERT INTO hits VALUES (rnd_str(36, 36, 0), 'https://questdb.io', systimestamp());
INSERT INTO hits VALUES (rnd_str(36, 36, 0), 'https://questdb.io', systimestamp());

This query is correct and when executed in localhost:9000 we get results:

SELECT a.part, coalesce(b.views, 0) as views FROM
    (SELECT part, 0 views FROM (SELECT case WHEN (hour(now()) + cast(x as int)) >= 24 THEN (hour(now()) + cast(x as int)) - 24 ELSE hour(now()) + cast(x as int) END AS part FROM long_sequence(24)) GROUP BY part) AS a
    LEFT JOIN (SELECT cast(hour(timestamp) as int) part, count() views FROM hits GROUP BY part) AS b
ON a.part = b.part

The process of producing the above SQL statement involves a lot of trial an error and in some cases the error log is not very helpful. In addition there is no way of copying the error message plus potentially its context stack to a text file for further analysis.

For illustration, if we accidentally allow Rufus (the cat) loose on the desk and he accidentally hits the ; key and this lands somewhere in our statement, for instance:

SELECT a.part, coalesce(b.views, 0) as views FROM
    (SELECT part, 0 views FROM (SELECT case WHEN (hour(now()) + cast(x as int)) >= 2;4 THEN (hour(now()) + cast(x as int)) - 24 ELSE hour(now()) + cast(x as int) END AS part FROM long_sequence(24)) GROUP BY part) AS a
    LEFT JOIN (SELECT cast(hour(timestamp) as int) part, count() views FROM hits GROUP BY part) AS b
ON a.part = b.part

The error simply says: dangling expression.

  • It would be nice if the error log contained similar information as bellow.
  • It would be nice if there was some form of visualising the error stack and copying message and all to the clipboard

Describe alternatives you've considered.

Using tools that rely on the postgres wire protocol, the error is more useful:

org.postgresql.util.PSQLException: ERROR: dangling expression
  Position: 136
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2657)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2347)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:337)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:325)
    at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:311)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:287)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:282)
    at io.quest.model.SQLExecutor.executeRequest(SQLExecutor.java:201)
    at io.quest.model.SQLExecutor.lambda$submit$1(SQLExecutor.java:142)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Additional context.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions