Database Reference
In-Depth Information
About this topic's code examples
The sample output shown here has been created with PostgreSQL's psql utility, usu-
ally running on a Linux system. Most of the code will work the same way if you are
using a GUI utility like pgAdmin3 to access the server instead. When you see lines
like this:
postgres=# SELECT 1;
The postgres=# part is the prompt shown by the psql command.
Examples in this book have been tested using PostgreSQL 9.2. They will probably
work on PostgreSQL version 8.3 and later. There have not been many major changes
to how server programming happens in the last few versions of PostgreSQL. The syn-
tax has become stricter over time to reduce the possibility of mistakes in server pro-
gramming code. Due to the nature of those changes, most code from newer versions
will still run on the older ones, unless it uses very new features. However, the older
code can easily fail to run due to one of the newly-enforced restrictions.
Switching to the expanded display
When using the psql utility to execute a query, PostgreSQL normally outputs the res-
ult using vertically aligned columns:
$ psql -c "SELECT 1 AS test"
test
------
1
(1 row)
$ psql
psql (9.2.1)
Type "help" for help.
postgres=# SELECT 1 AS test;
test
Search WWH ::




Custom Search