vscode-database-client icon indicating copy to clipboard operation
vscode-database-client copied to clipboard

[BUG] Postgres variables

Open Renato66 opened this issue 3 years ago • 1 comments
trafficstars

I'm trying to use variables in postgres

DO $$ 
DECLARE
   counter    INTEGER := 1;
   first_name VARCHAR(50) := 'John';
   last_name  VARCHAR(50) := 'Doe';
   payment    NUMERIC(11,2) := 20.5;
BEGIN 
   RAISE NOTICE '% % % has been paid % USD', counter, first_name, last_name, payment;
END $$;

error:

SQL:  DO $$ DECLARE counter INTEGER := 1

unterminated dollar-quoted string at or near "$$ DECLARE counter INTEGER := 1"
  • OS: Linux Ubunto
  • Database Type: PostgresSql

Renato66 avatar Jul 22 '22 18:07 Renato66

Hi, if you run all SQL it can run successfully, the program can't detect all SQL statements yet. image

cweijan avatar Jul 24 '22 11:07 cweijan

Hi, I have released version 5.7.6, which supports do syntax.

cweijan avatar Aug 30 '22 15:08 cweijan

Thanks 🙏

Renato66 avatar Aug 30 '22 17:08 Renato66