PostgreSQL

Скачать в pdf «PostgreSQL»


-X, -no-psqlre Do not read the start-up file /.psqlrc.


-?, -help Shows help about psql command line arguments.


Advanced features


Variables


psql provides variable substitution features similar to common Unix command shells. This feature is new and not very sophisticated, yet, but there are plans to expand it in the future. Variables are simply name/value pairs, where the value can be any string of any length. To set variables, use the psql meta-command set:


testdb=> set foo bar


sets the variable foo to the value bar. To retrieve the content of the variable, precede the name with a colon and use it as the argument of any slash command:


testdb=> eeho foo bar


Note: The arguments of set are subject to the same substitution rules as with other commands. Thus you can construct interesting references such as set foo ‘something’ and get soft links or variable variables, of Perl or PHP fame, respectively. Unfortunately (or fortunately?), there is no way to do anything useful with these constructs. On the other hand, set bar foo is a perfectly valid way to copy a variable.


If you call set without a second argument, the variable is simply set, but has no value. To unset (or delete) a variable, use the command unset.


psql’s internal variable names can consist of letters, numbers, and underscores in any order and any number of them. A number of regular variables are treated specially by psql. They indicate certain option settings that can be changed at runtime by altering the value of the variable or represent some state of the application. Although you can use these variables for any other

Скачать в pdf «PostgreSQL»