niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » PostgreSQL
UTF8 conversion differences from v8.1.3 to v8.1.4
Post new topic   Reply to topic Page 2 of 2 [17 Posts] View previous topic :: View next topic
Goto page:  Previous  1, 2
Author Message
Martijn van Oosterhout
*nix forums Guru


Joined: 02 Mar 2005
Posts: 674

PostPosted: Thu Jul 20, 2006 7:47 pm    Post subject: Re: UTF8 conversion differences from v8.1.3 to v8.1.4 Reply with quote

On Thu, Jul 20, 2006 at 12:07:54PM -0400, Eric Faulhaber wrote:
Quote:
Well, there's a really nasty workaround: create a cast from bytea to
text which doesn't change the value. This will get your data into the
database without any encoding checks at all. Ofcourse, you're then
responsible for any problems caused down the line...

Have a nice day,

Not sure I understand... at what point is the cast performed and what
type is actually stored in the database: text or bytea?

Well, the point is that there is actually no difference in how bytea
and text are stored. What you do is use a type-cast to relabel the data
to be text. So the fields in the database would be marked type text but
the data would be transferred there as bytea.

This doesn't fix the fact that the text functions can't handle embedded
nulls, but it's a workaround. Note that you bypass all encoding checks
this way so you're kind on of your own if it acts odd...

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
Back to top
Eric Faulhaber
*nix forums beginner


Joined: 18 Jul 2006
Posts: 8

PostPosted: Thu Jul 20, 2006 8:06 pm    Post subject: Re: UTF8 conversion differences from v8.1.3 to v8.1.4 Reply with quote

Martijn van Oosterhout wrote:
Quote:
On Thu, Jul 20, 2006 at 12:07:54PM -0400, Eric Faulhaber wrote:
Well, there's a really nasty workaround: create a cast from bytea to
text which doesn't change the value. This will get your data into the
database without any encoding checks at all. Ofcourse, you're then
responsible for any problems caused down the line...

Have a nice day,
Not sure I understand... at what point is the cast performed and what
type is actually stored in the database: text or bytea?

Well, the point is that there is actually no difference in how bytea
and text are stored. What you do is use a type-cast to relabel the data
to be text. So the fields in the database would be marked type text but
the data would be transferred there as bytea.

This doesn't fix the fact that the text functions can't handle embedded
nulls, but it's a workaround. Note that you bypass all encoding checks
this way so you're kind on of your own if it acts odd...

Have a nice day,

I see, thanks for the suggestion.

I'm also considering requiring UTF8 encoding at the server to make the
database consistent with the JDBC client. I suppose this also would
bypass the encoding check...

But I'm concerned that both approaches just delay the inevitable. If
the PG roadmap is to close all of these embedded null "loopholes" rather
than supporting these strings as first class citizens, I expect that a
future version will cut me off at the knees again when I least expect it :-(

Thanks,
Eric

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 2 of 2 [17 Posts] Goto page:  Previous  1, 2
View previous topic :: View next topic
The time now is Mon Dec 01, 2008 8:47 pm | All times are GMT
navigation Forum index » Databases » PostgreSQL
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts XML-RPC calls with real UTF8 data failed Erik Wasser Perl 0 Thu Jul 20, 2006 3:40 pm
No new posts C99 differences Joe Van Dyk C 1 Wed Jul 19, 2006 8:09 pm
No new posts How would I stop implicit type conversion srinivasarao_moturu@yahoo C++ 20 Mon Jul 17, 2006 11:24 am
No new posts Video conversion Jeremy Merritt Debian 3 Fri Jul 14, 2006 12:30 am
No new posts How to convert arbitrary objects directly to base64 witho... Qopit python 4 Thu Jul 13, 2006 2:41 pm

Project cars for sale | Apply for Credit Card | Loans | Mortgage Calculator | Internet Advertising
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 1.6094s ][ Queries: 16 (1.4877s) ][ GZIP on - Debug on ]