mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.45k stars 292 forks source link

executing create plpgsql function runs properly only if selecting the all function definition lines #1071

Open kfirufk opened 1 year ago

kfirufk commented 1 year ago

I'm using vscode version 1.74.2 with SQLTools extension v0.26.0 On MacOS Monterey 12.6.2 in order to work with a postgresql 15 database.

when i'm writing a plpgsql function, the editor marks in color the function besides the last line of END $$ LANGUAGE plpgsql.

SQLTools provides the shortcut called SQLTools Connection: Run current query

i can't use it because i get unterminated quoted string error.

so when I try to execute the run current query shortcut i get the following error:

unterminated dollar-quoted string at or near "$$ BEGIN return query select 1::int;" at character 61 I created a sample code:

create or replace function foo() returns table(test int) as $$
BEGIN
  return query select 1::int;
END $$ LANGUAGE plpgsql;

of course if i manually mark all the 4 lines and then run the query it creates the function properly, but this is very annoying since this is an example and i deal with complex functions and to start marking all of them in order to execute them each time is a hassle.

Wassim-Rached commented 8 months ago

reply to my boi