Database Reference
In-Depth Information
The preceding code will not print the comma and whitespace between lastname
and firstname if either firstname or lastname is not present. This effect is
used in the function format_us_address() with many levels of nesting to provide
an address that is visually appealing as well as postal processing friendly.
There are several statements in the code example showing how to use RAISE
NOTICE along with some text and a variable to provide debugging information as the
function is being called. For example, running our function in pgAdmin3 will produce
some notification messages:
You can see those messages in pgAdmin3 in the Messages tab in the following
screenshot:
The output of the same query in the command-line psql client is shown in the fol-
lowing code:
kroybal=# SELECT
format_us_full_name_debug('Mr','Kirk','L','Roybal','Author');
NOTICE: firstname mi.: Kirk L.
NOTICE: firstname mi. lastname: Kirk L. Roybal
NOTICE: prefix. firstname mi lastname: Mr.
Search WWH ::




Custom Search