Editor colour scheme - function overridden by keyword?

Not sure if I'm doing something wrong but I'm setting two colours:

 

Purple   --> keyword

Blue      --> procedure or function

 

For some reason COUNT gets the same colour as other keywords like INTERVAL, EXTRACT, COALESCE

 

But words like DATE_ADD, DATE_TRUNC, DATE_SUB  do not get any colours. 

0
9 comments

Just checked, looks like it works as expected. Could you please provide a screenshot with your settings and tell me DB you are working with?

0

Are you editing SQL file? If so, which dialect is selected for this file? If this is in console, which DB it is connected to and don't you change dialect here?

0

It is a saved sql file but same happens for writing queries in new tab. 

 

My connection is BigQuery which uses the JDBC driver and has dialect selected as Generic SQL.

The file also has Generic SQL dialect selected 

0

Could you please provide a piece of code with count() function where it is shown as keyword?

Date_add, date_sub and other similar functions are dialect specific (MySQL is most fit) and this is why they are not highlited in Generic, which is based on SQL-92.

0

If you look at the large screenshot above there are COUNTs everywhere in that script and they get highlighted in purple not blue

0

So will it be easier if I change the BigQuery connector default dialect to MySQL?

0

I see, but we need exact code block with 'select' and 'from' clauses to reproduce the issue with 'count()'.

Yes, you can set MySQL dialect,  probably it will work better in your case.

0

Here is the code:

 

SELECT
date,
DATE_DIFF(date, CURRENT_DATE(), DAY) AS day_offset,
(CASE WHEN COALESCE(NULLIF(EXTRACT(DAYOFWEEK FROM date) - 1, 0) , 7) < 6
THEN 1 ELSE 0 END) AS is_weekday
FROM UNNEST(GENERATE_DATE_ARRAY('2020-01-01', '2020-12-31', INTERVAL 1 DAY)) AS `date`
;
0

Please sign in to leave a comment.