1

I have noticed that the highlight missing after the ARRAY expression [ ]. The PSQL script can be run successfully but it's quite annoying.

SELECT ARRAY [ CONCAT('0', SUBSTRING(REGEXP_REPLACE(test.elec_num, '[^0-9]', '', 'g') FROM 3)) ] 
FROM test 
WHERE LENGTH(test.elec_num) > 10;

Is there any way to fix this issue?

enter image description here

1 Answer 1

1

I think the issue is that the SQL language support that comes out of the box with Visual Studio Code is configured for T-SQL, instead of PL/pgSQL like Postgres implements. It looks like the single quotes are throwing the syntax highlighting off in your case.

I found a Postgres Extension, called PostgreSQL that after installing, the syntax of your SQL above looks more appropriate (note, this is also after changing the language to postgres, which is added by this extension):

Sql

Sign up to request clarification or add additional context in comments.

1 Comment

Installed! Thank you, that makes sense since VS Code's Microsoft product. (That's why default SQL should set as T-SQL)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.