How to insert a carriage return and line field between fields in a query

From: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: How to insert a carriage return and line field between fields in a query
Date: 2015-07-09 23:10:19
Message-ID: CAAY=A79EJK6_kKTNOySKnJ73LpxUdcq-JBM+ZxkpwidWtjweoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a query like the following:

SELECT fld1 || fld2

I need to insert a carriage return (\r) and a line feed (\n) after each
field. How can I do this?

I tried
SELECT fld1 || \r\n || fld2 || \r\n
and also
SELECT fld1 || '\r\n' || fld2 || '\r\n'

without success.

I will very much appreciate your feedback.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2015-07-09 23:18:49 Re: How to insert a carriage return and line field between fields in a query
Previous Message Alex Ignatov 2015-07-09 17:28:27 Re: Strange DOMAIN behavior