BUG #6301: extra space in psql variable expansion
От | M |
---|---|
Тема | BUG #6301: extra space in psql variable expansion |
Дата | |
Msg-id | 201111181812.pAIICbGk056384@wwwmaster.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #6301: extra space in psql variable expansion
|
Список | pgsql-bugs |
The following bug has been logged online: Bug reference: 6301 Logged by: M Email address: sitrash@email.com PostgreSQL version: 8.4.9 Operating system: Linux Description: extra space in psql variable expansion Details: First of all, thank you for supporting a very useful product! When psql expands a :variable into a string it appends a space to the expansion string. For example: psql (8.4.9) Type "help" for help. testdb=> \set my_home /home/crazy testdb=> \echo :my_home/my-script.sql /home/crazy /my-script.sql Note the space between /home/crazy and /my-script.sql in the line above, while there's no space after /home/crazy two lines above where my_home variable is initialized. This prevents use of a variable for storing the directory name where a script to be sourced resides, as in \i :my_dir/my-script.sql because the expanded string contains a space between the expansion of :my_dir and the following /my-script.sql. I believe psql should expand the string :my_dir/my-script.sql into /home/crazy/my-script.sql (note the lack of space between crazy and the following / character). No popular scripting language I'm aware of appends the space character to an expanded variable, so psql's behavior is rather unusual. E.g. ${HOME}/my-script.sql expands into /home/crazy/my-script.sql in a Unix shell script.
В списке pgsql-bugs по дате отправления: