Separating raise notice lines

From: Radcon Entec <radconentec(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Separating raise notice lines
Date: 2009-06-23 20:27:38
Message-ID: 997172.2777.qm@web43408.mail.sp1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I like to use RAISE NOTICE statements to make sure my functions are working correctly.  I just wrote a trigger function that has the following code:

    -- We have a new tender.  Find out who it is.
    select into userRecord * from users where users_key = new.tender_key;
    if not found then
 raise exception 'Could not store furnace tender information; no user has a key of %', new.tender_key;
    else
 raise notice 'User name is % %', userRecord.name, chr(10);
    end if;
    -- Now we can store the information.
    insert into furnace_tender_history (area, tender_name, tender_checknum, signin_time, signin_time_utc)
    values (new.area, userRecord.name, userRecord.check_number, current_timestamp, current_timestamp at time zone 'utc');
    raise notice 'History record should be added%', chr(10)::text;
    return new;

I am trying to insert a carriage return character (chr(10)) in the user name notice so that any subsequent notices will appear on separate lines.  However, when I use a query to update a field that will fire this trigger, the Messages tab contains this:

NOTICE:  User name is capsNOTICE:  History record should be added
Query returned successfully: 1 rows affected, 16 ms execution time.

How can I get the notices to appear on separate lines?

Thanks very much!

RobR

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jack Orenstein 2009-06-23 20:33:39 Query optimizer & prepared statements
Previous Message Merlin Moncure 2009-06-23 19:22:19 Re: help with data recovery from injected UPDATE