question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SQL query field can't begin by a comment

See original GitHub issue

image

SQL comments are very useful to explain the meaning of the query. It’s currently impossible to put it at the beginning of the field as seen on the screen capture: it leads to an error: Statement must be a SELECT.

It would be great to make it possible because:

  • as the request is the title of the page:
    • it eases the search with search engines
    • it eases the search in the browsers’ url field
  • it acts as a kind of title: the global meaning of the query is immediately understandable
  • some tools, such as Slack, are shortening long URLs and displaying the beginning of the URLs (eg. https://example.org/products?sql=select+%28length%28data_quality_errors_ta[...]+%21%3D+%22%22+group+by+NB_of_issues+order+by+NB_of_issues+desc+limit+200)

Beginning a query with a comment is possible with SQLite.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
simonwcommented, Oct 27, 2022

I think mine has a better pattern for handling /* ... anything in here that isn't */ ... */

1reaction
simonwcommented, Oct 26, 2022

Yeah we should fix this.

https://www.sqlite.org/lang_comment.html - SQLite also supports -- style comments.

I like how explicit the documentation is here:

SQL comments begin with two consecutive “-” characters (ASCII 0x2d) and extend up to and including the next newline character (ASCII 0x0a) or until the end of input, whichever comes first.

C-style comments begin with “/" and extend up to and including the next "/” character pair or until the end of input, whichever comes first. C-style comments can span multiple lines.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Comments Within SQL Statements
Begin the comment with -- (two hyphens). Proceed with the text of the comment. This text cannot extend to a new line. End...
Read more >
SQL Comments - W3Schools
Comments are used to explain sections of SQL statements, or to prevent execution of SQL statements. ... Multi-line comments start with /* and...
Read more >
sql - Why can't I see comment on column? - Stack Overflow
You need to query Data Dictionary view USER_COL_COMMENTS to display comments on the columns of the tables and views owned by the current ......
Read more >
Never, Ever, Ever Start T-SQL Comments with Two Dashes
Never, ever use two dashes. Never. ... And you can't tell where the query really ends. This REALLY causes problems with real-world-size queries...
Read more >
How to Enter SQL Comments - IBM
The following table shows the SQL comment indicators that you can enter in your code. Here a Y in a column signifies that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found