Thread: Questions about octal vs. hex for bytea

Questions about octal vs. hex for bytea

From
"Reuven M. Lerner"
Date:
Hi, everyone.  I've got a client who is planning to upgrade from
PostgreSQL 8.3 to 9.0 in the coming weeks.  They use a lot of tables
with bytea columns.  They're worried about the switch from octal to hex
formats for bytea data.


Based on everything I know and have read, the change is only for
external representations, for input and output.  Output is now by
default in hex, but can be changed with a parameter (bytea_output) that
provides backward compatibility.  Input can be in either octal or hex,
with no changes needed.


My client is concerned that the internal representation has changed, and
is asking me for a script that will change the representation, in order
to save space (since hex occupies less space than octal).  I'm not aware
of such a need, or even the possibility for this to be done; even if the
internal representation has changed, it'll be handled in the upgrade
process, and doesn't need to be done with anything external.


So I've told them that I don't think that anything is necessary for
either input or output, except (perhaps) to set bytea_output in its
backward-compatibility mode.  But I wanted to check with people here,
just to double-check my understanding.


Thanks in advance,


Reuven

--
Reuven M. Lerner -- Web development, consulting, and training
Mobile: +972-54-496-8405 * US phone: 847-230-9795
Skype/AIM: reuvenlerner


Re: Questions about octal vs. hex for bytea

From
Andreas Kretschmer
Date:
Reuven M. Lerner <reuven@lerner.co.il> wrote:
> So I've told them that I don't think that anything is necessary for
> either input or output, except (perhaps) to set bytea_output in its
> backward-compatibility mode.  But I wanted to check with people here,
> just to double-check my understanding.

You are right, there is no other problem. I have upgraded a customer's
database from 8.3 to 9.0, it was a DRUPAL - database. Only backup &
restore and set the bytea_output - Parameter, that's all.


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: Questions about octal vs. hex for bytea

From
"David Johnston"
Date:
Been using bytea heavily through JDBC.  In transitioning to 9.0 I've found the need to set the bytea_output parameter
butotherwise everything else works the same as it did before. 

As for storage space concerns I do not know for sure but the numbers cannot be that substantial to warrant changing an
existingdatabase unless large binary processing takes up a significant portion of the processing (as opposed to simple
documentstorage and retrieval which is what I am doing). 

David J.

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Reuven M. Lerner
Sent: Sunday, February 20, 2011 6:31 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Questions about octal vs. hex for bytea

Hi, everyone.  I've got a client who is planning to upgrade from PostgreSQL 8.3 to 9.0 in the coming weeks.  They use a
lotof tables with bytea columns.  They're worried about the switch from octal to hex formats for bytea data. 


Based on everything I know and have read, the change is only for external representations, for input and output.
Outputis now by default in hex, but can be changed with a parameter (bytea_output) that provides backward
compatibility. Input can be in either octal or hex, with no changes needed. 


My client is concerned that the internal representation has changed, and is asking me for a script that will change the
representation,in order to save space (since hex occupies less space than octal).  I'm not aware of such a need, or
eventhe possibility for this to be done; even if the internal representation has changed, it'll be handled in the
upgradeprocess, and doesn't need to be done with anything external. 


So I've told them that I don't think that anything is necessary for either input or output, except (perhaps) to set
bytea_outputin its backward-compatibility mode.  But I wanted to check with people here, just to double-check my
understanding.


Thanks in advance,


Reuven

--
Reuven M. Lerner -- Web development, consulting, and training
Mobile: +972-54-496-8405 * US phone: 847-230-9795
Skype/AIM: reuvenlerner


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Questions about octal vs. hex for bytea

From
Radosław Smogura
Date:
"Reuven M. Lerner" <reuven@lerner.co.il> Sunday 20 February 2011 12:31:09
> Hi, everyone.  I've got a client who is planning to upgrade from
> PostgreSQL 8.3 to 9.0 in the coming weeks.  They use a lot of tables
> with bytea columns.  They're worried about the switch from octal to hex
> formats for bytea data.
>
>
> Based on everything I know and have read, the change is only for
> external representations, for input and output.  Output is now by
> default in hex, but can be changed with a parameter (bytea_output) that
> provides backward compatibility.  Input can be in either octal or hex,
> with no changes needed.
>
>
> My client is concerned that the internal representation has changed, and
> is asking me for a script that will change the representation, in order
> to save space (since hex occupies less space than octal).  I'm not aware
> of such a need, or even the possibility for this to be done; even if the
> internal representation has changed, it'll be handled in the upgrade
> process, and doesn't need to be done with anything external.
>
>
> So I've told them that I don't think that anything is necessary for
> either input or output, except (perhaps) to set bytea_output in its
> backward-compatibility mode.  But I wanted to check with people here,
> just to double-check my understanding.
>
>
> Thanks in advance,
>
>
> Reuven

There is no internal change how bytea is keept or at least internally data are
not keept in octal or hex represenation. If your client uses JDBC it's better
to download newest driver. It should support as well hex and octal receive. It
is safer to turn on backward compatibility. I know nothing how pg_dump will
work to migrate data.

Regards,
Radek

Re: Questions about octal vs. hex for bytea

From
Tom Lane
Date:
"Reuven M. Lerner" <reuven@lerner.co.il> writes:
> My client is concerned that the internal representation has changed, and
> is asking me for a script that will change the representation, in order
> to save space (since hex occupies less space than octal).

This is complete nonsense.  The internal representation is just bytes.

            regards, tom lane

Re: Questions about octal vs. hex for bytea

From
"Reuven M. Lerner"
Date:
Thanks, everyone, for the swift and clear responses.  It's good to know
that I did understand things correctly!

Reuven