Re: Entering a character code in a query

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "John Gage *EXTERN*" <jsmgage(at)numericable(dot)fr>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Entering a character code in a query
Date: 2010-03-09 12:32:25
Message-ID: D960CB61B694CF459DCFB4B0128514C2039381E5@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John Gage wrote:
> I would like to use the following query:
>
> SELECT english || '\n' || english || '\x2028' || french AS
> output FROM vocab_words_translated;
>
> where \x2028 is the hexadecimal code for a soft carriage return.
>
> However, this does not work.
>
> Can anyone help with this problem?

If you have PostgreSQL 8.4 with standard_conforming_strings = on,
you could write:

english || E'\n' || english || U&'\2028' || french

Otherwise, you have to resort to

english || E'\n' || english || chr(8232) || french

(provided your server_encoding is UTF8).

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Royce Ausburn 2010-03-09 13:11:57 How many file descriptors does postgres need?
Previous Message Albe Laurenz 2010-03-09 12:23:06 Re: Libpq: copy file to bytea column