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.

Failure to select column named "end", keyword is not ignored.

See original GitHub issue

I came across dbeaver/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLConstants.java after a user reporting failure to select data from a column that matches “end”. Can this keyword be avoided in this context? I understand that quoting or using backticks will work, but the aim here is to allow this to function so itellisense runs more smoothly. Is there a way to make exceptions / auto quote certain keywords?

Reproducible steps:

drop table if eixsts somedb.test_reserved_keywords;
show create table somedb.test_reserved_keywords;

Create basic table

create table if not exists somedb.test_reserved_keywords
(col1 string, col2 string, `end` string, `COUNT` int)
STORED AS ORC LOCATION '/group/somedb/hive/test_reserved_keywords';

Test

select * from somedb.test_reserved_keywords where COUNT = '';
[OK]
select * from somedb.test_reserved_keywords where end = '';
[FAIL]

# END is within the reserved keywords list.
select * from somedb.test_reserved_keywords where END = '';
[FAIL]

Error message:

Error while compiling statement: FAILED: ParseException line 1:54 cannot recognize input near 'end' '=' '''' in expression specification
  Error while compiling statement: FAILED: ParseException line 1:54 cannot recognize input near 'end' '=' '''' in expression specification
    org.apache.hadoop.hive.ql.parse.ParseException:line 1:54 cannot recognize input near 'end' '=' '''' in expression specification
    org.apache.hadoop.hive.ql.parse.ParseException:line 1:54 cannot recognize input near 'end' '=' '''' in expression specification

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
serge-ridercommented, Oct 21, 2019

@mtdeguzis You can enclose end in double quotes, like this:

select * from cdis_it_db.test_reserved_keywords where "end" = '';
0reactions
mtdeguziscommented, Oct 21, 2019

Sure, thankfully the database connection settings migrate fine on OS X, and I can have multiple side by side by the nature of the DMG. image

Version 6.2.3.201910201831

query

drop table if exists cdis_it_db.test_reserved_keywords;

create table if not exists cdis_it_db.test_reserved_keywords
(col1 string, col2 string, `end` string, `COUNT` int)
STORED AS ORC LOCATION '/group/cdis_it_db/hive/test_reserved_keywords';

--ok
select * from cdis_it_db.test_reserved_keywords where COUNT = '';

--fail
select * from cdis_it_db.test_reserved_keywords where end = '';

Still fails

Error occurred during SQL query execution

Reason:
SQL Error [40000] [42000]: Error while compiling statement: FAILED: ParseException line 2:50 cannot recognize input near 'end' '=' '''' in expression specification
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't select column name that is a SQL keyword
There are a variety of poorly named columns, such as "index", but doing something like a.index works fine. I've not run into this...
Read more >
SQL error messages and exceptions - Oracle Help Center
A qualified column name ' <columnName> ' is not allowed in the ORDER BY clause. 42878, The ORDER BY clause of a SELECT...
Read more >
Database engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
9.3 Keywords and Reserved Words - MySQL :: Developer Zone
Certain keywords, such as SELECT , DELETE , or BIGINT , are reserved and require special treatment for use as identifiers such as...
Read more >
Syntax and options of the UNLOAD control statement - IBM
If the table does not have any XML or LOB columns, SPANNED YES is ignored. ... the keywords and field-names that are used...
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