Search code examples
sqlpostgresqldbeaver

Insert literal '${value}' without variable substitution into PostgreSQL table from DBeaver


I'm trying to do an insert like this into my PostgreSQL table:

INSERT INTO table (path, regex, replacement_path, uri)
VALUES ('/api/foo/**', '/foo/(?<value>.*)', '/foo/${value}', 'http://localhost:8080');

However, the '/foo/${value}' portion is being changed to '/foo/NULL' when it is inserted into the DB. I figure it's expecting a variable there, but I need the string inserted verbatim.

I tried escaping the curly brackets and dollar sign, but to no avail. Does anyone have any suggestions?


Solution

  • It turns out that this was caused by the client itself NOT the database or SQL dialect.

    DBeaver has its own support for variables and variable substitution independent of the database: https://github.com/dbeaver/dbeaver/wiki/SQL-Execution#parameters-and-variables

    This is (apparently) enabled by default in recent versions of dbeaver, and can be disabled via Window > Preferences > Editors > SQL Editor > SQL Processing:

    DBeaver preferences window