[Databricks SQL] Commented Escape Character (\) Causes Unexpected Behavior

Graham
New Contributor III

The Problem:

I've observed erratic behavior when I add a comment containing a trailing escape character (\) to a CREATE TABLE statement.

For example, this query returns data (though it shouldn't):

CREATE TABLE example_table
SELECT 1
-- This comment has an escape character: \
WHERE 1 = 0;
 
SELECT * FROM example_table;

Has anyone seen this?

JBOCACHICA
Databricks Partner

I recommend you to go to your query plan in order to understand what is happening on the background.

Regards

BilalAslamDbrx
Databricks Employee
Databricks Employee

@Graham Carman​ that's definitely odd, I can reproduce it. I'll follow up on this.

BilalAslamDbrx
Databricks Employee
Databricks Employee

@Graham Carman​ we're tracking this as a defect / issue on our side. For now, please don't include the escape character in comments.

View solution in original post

Hi @Graham Carman​,

Just a friendly follow-up. Did any of the responses help you to resolve your question? if it did, please mark it as best. Otherwise, please let us know if you still need help.