Trivadis / pgbasenv

pgBasEnv - PostgreSQL Base Environment Tool

Home Page:https://github.com/Trivadis/pgbasenv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On Debian the .psqlrc runs into an error - :VERSION_NAME is wrong

markusdba opened this issue · comments

pascal:/var/lib/postgresql [pgd13]$ psql
psql:/var/lib/postgresql/.psqlrc:5: ERROR: syntax error at or near "("
LINE 1: select substring(''||13.5 (Debian 13.5-0+deb11u1), 1, positi...
^
psql:/var/lib/postgresql/.psqlrc:6: error: /var/lib/postgresql/tvdtoolbox/pgbasenv/scripts/.run.:pgreleasenum: No such file or directory
psql (13.5 (Debian 13.5-0+deb11u1))
Type "help" for help.

Hi Markus, what returns this statement on your system?

select ''||:VERSION_NAME;

Hi @markusdba
could you share the contents of .psqlrc?

best,
michael

Everything generated by pgBasenv:

pascal:/var/lib/postgresql [pgd13]$ cat .psqlrc
-- PGBASENV BEGIN ---------------------------------
\set pgbasenv_base echo "/var/lib/postgresql/tvdtoolbox/pgbasenv"
! /var/lib/postgresql/tvdtoolbox/pgbasenv/bin/scriptmgr.sh prep
select substring(''||:VERSION_NAME, 1, position('.' in ''||:VERSION_NAME)-1) as pgreleasenum
\gset
\i :pgbasenv_base/scripts/.run.:pgreleasenum
-- PGBASENV END -----------------------------------

did you use the built-in debian postgres repo?

If yes I would recommend to use the public postgres repo and test again

Hi Markus, I think we found the workaround resp. fix. Can you please adapt temporarily your .psqlrc file and add two single quotes? Please set :VERSION_NAME in your .psqlrc into single quotes like this: :'VERSION_NAME'

select substring(''||:'VERSION_NAME', 1, position('.' in ''||:'VERSION_NAME')-1) as pgreleasenum

If this works, Michael will add the fix... Thank you!