Writing Functions

Discussion of open issues, suggestions and bugs regarding database management and development tools for PostgreSQL
Post Reply
Thys
Posts: 4
Joined: Wed 03 Jul 2019 05:07

Writing Functions

Post by Thys » Wed 03 Jul 2019 05:22

I'm new to using dbForge for PostgreSQL, and in general new to using PostgreSQL. So my question might have a simple solution.

Within a function, the logic is enclosed in two sets of $$-characters, rendering everything in between as a string - and therefore not susceptible for any code checking or code completion. This makes it hard to use the built-in tools that dbForge offers.

Is there a way around this, so that code within the $$-block is not regarded as a string?

Thanks

alexa
Devart Team
Posts: 2779
Joined: Fri 24 Jun 2011 14:17

Re: Writing Functions

Post by alexa » Wed 03 Jul 2019 11:34

This is a correct behavior since, in PostgreSQL, a procedure's body is a string constant https://www.postgresql.org/docs/11/sql- ... ction.html

In the editor of dbForge Studio 2019 for Postgre SQL, all string constants are red marked by default.

In order the Code Completion to work inside a string constant of a procedure's body, there is Dollar-Quoted $plpgsql$ in dbForge. In any other Dollar-Quoted, a procedure's body will be displayed as a normal string constant, i.e. with a red font by default.

Thys
Posts: 4
Joined: Wed 03 Jul 2019 05:07

Re: Writing Functions

Post by Thys » Wed 03 Jul 2019 12:31

Perfect!

$plpgsql$ does the trick.

Thanks

alexa
Devart Team
Posts: 2779
Joined: Fri 24 Jun 2011 14:17

Re: Writing Functions

Post by alexa » Wed 03 Jul 2019 15:00

Thank you for updating us on this issue.

Please let us know if any questions arise.

Post Reply