Thread: raise doesn't add end of line

raise doesn't add end of line

From
"Sabin Coanda"
Date:
Hi there,

I upgrade "PostgreSQL 8.2.4 on i686-pc-mingw32, compiled by GCC gcc.exe 
(GCC) 3.4.2 (mingw-special)" to "PostgreSQL 8.3.5, compiled by Visual C++ 
build 1400", and I found that many RAISE statements in a function no more 
adds end of line (CR/LF) on every message. Just when the funcion ends a 
CR/LF is added in the log.

Is it the same behavior on linux os ?
Do you know a trick to get my old end of lines ?

TIA,
Sabin 




Re: raise doesn't add end of line

From
"Sabin Coanda"
Date:
Also I found all the characters E'\n' in a raise are filtered and not 
logged.
I don't beleave no one knows how to log the end of line, maybe by a related 
configuration setting.

Please help, or at least confirm there is a bug, to not waste time looking 
for workarounds. I'm disperate all my usefull multiline logs are now useless 
:(

TIA,
Sabin 




Re: raise doesn't add end of line

From
"Pavel Stehule"
Date:
Hello

it's true, and I thing, so it is a bug (please, report it). Workaround
is simple. Use function chr.

regards
Pavel Stehule

postgres=# create or replace function r() returns void as $$begin
raise notice 'aa%naata%aa', chr(10),chr(10); end; $$ language plpgsql;
CREATE FUNCTION
postgres=# select r();
NOTICE:  aa
naata
aar
---

(1 row)



2008/11/17 Sabin Coanda <sabin.coanda@deuromedia.ro>:
> Also I found all the characters E'\n' in a raise are filtered and not
> logged.
> I don't beleave no one knows how to log the end of line, maybe by a related
> configuration setting.
>
> Please help, or at least confirm there is a bug, to not waste time looking
> for workarounds. I'm disperate all my usefull multiline logs are now useless
> :(
>
> TIA,
> Sabin
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>


Re: raise doesn't add end of line

From
"Sabin Coanda"
Date:
Hi Pavel,

I tried on Windows, and it works. Thanks a lot.

BTW, I didn't succeed to find char(10) workaround because I tried at the end 
of the line, where ... it doesn't work.

For instance check the function:

-- Function: r()

-- DROP FUNCTION r();

CREATE OR REPLACE FUNCTION r() RETURNS void AS
$BODY$begin
raise notice 'Break the 1st%line...', chr(10);
raise notice 'eol on 2nd line...%', chr(10);
raise notice '3rd line';
end; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100;
ALTER FUNCTION r() OWNER TO postgres;


Run it:   SELECT r()

And you get:

NOTICE:  Break the 1st
line...NOTICE:  eol on 2nd line...NOTICE:  3rd line