useful postgresql commands¶
restore backup inside a .tar.bz2
file¶
search for the .out
file inside the .tar.bz2
file.
this command list all files inside the compressed file.
now, create the new database.
use the correct .out
path (inside the .tar.bz2
) in the tar
command, to the stdout. at the same time, send the stdout to psql
.
show NULL
fields on psql
¶
normally, the psql
command leave the null fields blank, when you run a query. to force psql
to showthe null values, use the \pset
command.
rodrigo@server:~$ psql test_db
psql (9.1.11)
Type "help" for help.
test_db=# SELECT NULL;
?column?
----------
(1 row)
test_db=# \pset null '(null)'
Null display is "(null)".
test_db=# SELECT NULL;
?column?
----------
(null)
(1 row)
test_db=# \q
rodrigo@server:~$
in the example above, we see how postgresql shows the null value before and after the \pset
command. the chosen text to represent the null value was (null)
, but can be any other string.
this configuration is available only in this psql
execution.
reference: Output Format Options