Error that is not an error

I am getting an error detected by DataGrip that is not an error:

select top 10 * <-- squiggly here
from main.my_table

The red squiggly line says: <expression> expected, got 'from'

When I execute, the query goes through and brings back results.

Lately I have been using SQL Workbench but I missed the static analysis capabilities of Microsoft SQL Server. So I was really excited about DataGrip when I heard about it. So it's really disheartening that such a simple snippet of code would falsely detect an error.

Does DataGrip always run queries regardless of potential detected errors? Or does DataGrip ever elect to not execute a statement that it deems to be "incorrect"? Because if it is the latter case, then that is a deal breaker.

8 comments
Comment actions Permalink

Seems to work ok, can you provide the screenshot if it still gives the error?

0
Comment actions Permalink

I need to mention that in any case if DataGrip detects the error where there is no error, you can select the whole statement and run it.

0
Comment actions Permalink

Hello Maxim,

It was my own error. I was connecting using a PostgresSQL driver. Thus the correct syntax is:

SELECT *
FROM some.db
LIMIT 10

I suppose the confusion was because my original query was still running.

0
Comment actions Permalink

So, I am happy that all is ok :)

0
Comment actions Permalink

While we're on this topic, I have some DDLs for Amazon Redshift.

create table some.sb (
p_id int encode raw,
name varchar(100) encode lzo,
process_date timestamp encode lzo,
primary key (p_id)
)
distkey (name)
sortkey(process_date);

In the above, the keywords distkey and encode are both highlighted as errors. Do you know if this error also has to do with the driver? If so, what the resolution is?

0
Comment actions Permalink

Samuel, we don't support specific things for Redshift. So if some syntax is ok for Redshift but not ok for Postgres, we will treat it as an error. So, for now the only way to run it is select → run.

Also you can vote here: https://youtrack.jetbrains.com/issue/DBE-1459

0
Comment actions Permalink

I have some problem

0

Please sign in to leave a comment.