Start a new topic

PostgreSQL variable substitution

[This topic is migrated from our old forums. The original author name has been removed]

The syntax for variable substitution in the PostgreSQL psql client is :name Is is possible to configure DbVis 9.0 to recognize this format?

[This reply is migrated from our old forums.]

Re: PostgreSQL variable substitution
Hi Matt, This is not possible in the current version, but we have it on our list of things to look into. I've added your vote for this. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: PostgreSQL variable substitution
Any progress on this? All of our queries use the :variableName syntax using the colon.
[This reply is migrated from our old forums.]

Re: PostgreSQL variable substitution
Jeff, For PostgreSQL the JDBC driver supports ? as a parameter marker. I just browsed through their latest driver and it doesn't seem to support :varName. DbVisualizer supports the ? syntax in the DbVisualizer Pro edition. Are you using PostgreSQL? Browsing the DB documentation doesn't list :varName as being supported. Regards Roger
[This reply is migrated from our old forums. The original author name has been removed]

Re: PostgreSQL variable substitution
We are basically switched over to PostgreSQL 9.3 now...just have not released it to production. We have been using the pgadmin client tool but are hoping to find something better. Some people use SQuirreL SQL Client which is serviceable at best. But it does do variable substitution with named parameters using the colon syntax. My assumption is that they are converting the named parameter syntax to ? for us. Spring does that as well with their jdbc abstractions.
[This reply is migrated from our old forums.]

Re: PostgreSQL variable substitution
Jeff, We have on the todo list for next feature version to support named parameters not only for databases that already supports them but for any database. The rough schedule for this version is in the Q3 timeframe. Regards Roger
[This reply is migrated from our old forums.]

Re: PostgreSQL variable substitution
Jeff, Just to inform you that we've released a beta of the upcoming 9.2 version with support for ?, :var, &var and :{var}. Give it a try: http://www.dbvis.com/download/beta/ Regards Roger
[This reply is migrated from our old forums.]

Re: PostgreSQL variable substitution
Hi all, DbVisualizer 9.2 has just been released with support for parameter markers. http://www.dbvis.com/doc/relnotes/?version=9.2&showtoc=false Regards Roger

Could it be possible to also implement the \set mechanism of defining the key-value pairs as it is done in either PostgreSQL's psql [1] or Vertica's vsql [2]?


My current problem is that when I have some named parameter markers that I want to apply to a series of 20 or so SQL-statements (same values for all statements), I have to press the 'Continue' button in pop-up dialogs 20 or so times after selecting those statements and 'Ctrl+.'. It would be so much more convenient to be able to define those parameters in the code, as psql and vsql allow me to.


Also, such addition would make it easy to run the same parameterized SQL scripts in either psql/vsql or DBVis.


[1] http://www.postgresql.org/docs/current/static/app-psql.html

[2] https://my.vertica.com/docs/7.1.x/HTML/index.htm#Authoring/ConnectingToHPVertica/vsql/Variables.htm

Vladim,


Your request is certainly good. The main challenge however is that it would be a rather big hassle offering support for other tools variable management in DbVisualizer. 


In DbVisualizer there is the ${variable}$ syntax which has been around since the early days of DbVisualizer with support for default values and a lot more, and since 9.2 there is now also support for parameter markers that are found in most programming languages, such as :var, ?, :'var', and so on. 


I will open a new feature request ticket and we will have a discussion internally.


Regards


Roger

Thank you, Roger.


I would also note that this \set feature seem to be present in many PostgreSQL-derived databases:

https://wiki.postgresql.org/wiki/PostgreSQL_derived_databases

Login or Signup to post a comment