Re: encode(bytea_value, 'escape') in PostgreSQL 9.0

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: encode(bytea_value, 'escape') in PostgreSQL 9.0
Date: 2010-12-13 10:14:59
Message-ID: ie4rn3$scs$8@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2010-12-06, Florian Weimer <fweimer(at)bfk(dot)de> wrote:
> * Tom Lane:
>
>> Florian Weimer <fweimer(at)bfk(dot)de> writes:
>>> The old 'escape' encoding used by PostgreSQL 8.4 and prior was pretty
>>> helpful for getting human-readable strings in psql. It seems this
>>> functionality was removed in PostgreSQL 9.0. Was this an accident or
>>> a deliberate decision? Could we get it back, please?
>>
>> I think you're looking for "set bytea_output = escape".

> To me, this seems problematic as a general recommendation because
> programs won't use this,

programs should be using libpq's unescape_bytea and thus be
immune to changes in the representation.

If you want predictable representation base64 (or hex) your data and
store it in a text column postgres will compress long values so not
hardly any space will be wasted.

> and it's confusing to have different output
> in psql than what your program sees. That's why I don't want to put
> it into .psqlrc. The separate command will raise a few eyebrows here
> and there. 8-/

ALTER DATABASE whatever SET bytea_output = escape;

or

ALTER USER whoever SET bytea_output = escape;

--
⚂⚃ 100% natural

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pasman pasmański 2010-12-13 10:22:56 Fatal accident :)
Previous Message Jasen Betts 2010-12-13 10:03:07 Re: Do we want SYNONYMS?