1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
-- echo all
\set ECHO all
-- conditional variables display FALSE when name is not set
\unset foo
\echo :{?foo}
-- conditional variables display TRUE when name is set
\set foo 'bar'
\echo :{?foo}
-- single quoted strings will decode '' as ' and decode \n, \t, \b, \r, \f, \digits octals, \xdigits (standard escapes)
\set foo 'bar''bar\r\n'
-- single quoted variables escape ' but does not escape special characters
\echo :'foo'
-- double quoted variables do not escape ' or special characters
\echo :"foo"
-- single quoted strings decode any other standard escape (\<char>) as literal
\set foo 'bar\'''bar'
\echo :foo
\echo :'foo'
-- single quoted variables escape \ with E'' style strings
\set foo 'bar\\\''
\echo :foo
\echo :'foo'
\echo :"foo"
-- backticks interpolate unquoted variables
\set foo 'bar'
\echo `echo :foo`
-- backticks interpolate single quoted variables
\echo `echo :'foo'`
-- backticks do not interpolate double quoted variables
\echo `echo :"foo"`
-- backticks have error messages for single quoted variables containing \r or \n when using :'' syntax
\set foo 'bar\r\n'
\echo `echo :'foo'`
|