I am trying to insert a row with a string column that contains new line character. The create table statement and insert query are given below.
create table stringtest(id int, inputstr character varying(200));
insert into stringtest values(1,'Name : NOC\r\n\r\nDetail : Detail');
The insert query is executed properly. However when the same row is fetched(when the postgres is in linux), the value of inputstr is not displayed with new line instead it is displayed as
id | inputstr
----+---------------------------------------------------
1 | Name : NOC\r\n\r\nDetail : Detail
While if we do the same in the windows, we get the resultset as desired as provided below
ngnms=# select * from stringtest;
id | inputstr
----+----------------------------
1 | Site Name : NOC\r +
| \r +
| Device Detail : agentdname
(1 row)
what should be done to get the result as desired with the new line instead of escape characters
Point to be added is if the same row is inserted using copy, the new line is preserved properly