executing create plpgsql function in vscode runs properly only if selecting the all function definition lines

148 Views Asked by At

I'm using vscode version 1.74.2 with SQLTools extension v0.26.0 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.

as you can see in the following screenshot it marks only the 3 first lines when i go with the keyboard cursor over the function definition:

cursor over plpgsql create function

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

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.

any ideas how i can resolve this ?

0

There are 0 best solutions below