Re: Regarding bytea column in Posgresql - Mailing list pgsql-general

From Deole, Pushkar (Pushkar)
Subject Re: Regarding bytea column in Posgresql
Date
Msg-id 78A4D6BFBAA5BA49A5E94DA00A6A76E353E0F3@AZ-FFEXMB04.global.avaya.com
Whole thread Raw
In response to Re: Regarding bytea column in Posgresql  (John R Pierce <pierce@hogranch.com>)
List pgsql-general
John,

Please find my response inline.

Thanks..

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of John R Pierce
Sent: Friday, April 10, 2015 12:57 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Regarding bytea column in Posgresql

On 4/9/2015 4:10 AM, Bill Moran wrote:
>> 1.       Is 'bytea' column intended for storing text data?
> No, it's intended for storing binary data.
>
>> >2.       Typically a chat can have text data with several special characters (which can be represented in multi
bytes),how these characters can be stored in a bytea column and retrieved back properly?
 
> bytea won't help you here. You'll have to manage the special 
> characters entirely in your code. bytea gives you back the exact same 
> types you put in, with no changes or interpretation.
>
> A better choice would be to use a text field with a proper text 
> encoding (such as utf-8).

one possible rationale for using BYTEA is that the data could be in various encodings, which the application wishes to
preserve,and keeps 
 
track of somewhere else (perhaps in a field within the XML?).      
PostgreSQL text types would insist that all text be stored in the same encoding, and anything in a different encoding
wouldhave to be 
 
converted to the database encoding.   Me, I'd be inclined to convert 
everything to UTF8 and store it as such, and convert it back to the user's encoding on display, but the feasibility of
thisreally depends on the use cases.
 

-- 
john r pierce, recycling bits in santa cruz

--> I confirmed with the developers who had originally developed this product and as per them, the xml is in UTF-8
encoding.So, ideally it would have been better to have a text or XML column type.
 


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

https://urldefense.proofpoint.com/v2/url?u=http-3A__www.postgresql.org_mailpref_pgsql-2Dgeneral&d=AwICaQ&c=BFpWQw8bsuKpl1SgiZH64Q&r=9JxdEvGq7qy3NnL3UxN47w&m=c2bN1y5Oj6SbZjRfape8xKIQXIPlu4MRCwHN76YWi1I&s=BTWMlID5cymS2KBU5tS__D7oiNHtLnjEsuiZ8TswAvA&e=


pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Background worker assistance & review
Next
From: Миша Тюрин
Date:
Subject: PgFoundry is mostly dead