Database Reference
In-Depth Information
''Manual''
debugging
with
RAISE
NOTICE
You might want to have a look at Chapter 10 , Publishing Your Code as PostgreSQL .
That chapter includes some samples (and an extremely handy way to install them)
that will be useful here in this part of the topic. The examples will be shown again
here in the text of this chapter, but they would be quite a bit easier for you to install
as an extension.
Here is the first promised example:
CREATE OR REPLACE FUNCTION
format_us_full_name_debug(
prefix
text,
firstname text,
mi
text,
lastname text,
suffix
text)
RETURNS text AS
$BODY$
DECLARE
fname_mi text;
fmi_lname text;
prefix_fmil text;
pfmil_suffix text;
BEGIN
fname_mi := CONCAT_WS(' ', CASE
trim(firstname) WHEN '' THEN NULL ELSE
firstname END, CASE trim(mi) WHEN '' THEN NULL
ELSE mi END || '.');
RAISE NOTICE 'firstname mi.: %', fname_mi;
Search WWH ::




Custom Search