Jorge Godoy wrote: > Em Sexta 28 Abril 2006 14:07, Baruch escreveu: >> I do wonder how PostgreSQL handles this case? Does it not truncate the >> string, or does it truncate it smartly? > > It does truncate if the string is bigger than the column. In this case, as > I've shown you, PostgreSQL does the right thing.
IMO "doing the right thing" would be an SQL error. The Zen of Python, errors shouldn't go unnoticed? > The thing is that the database should know what encode to use. I haven't > created an ISO-8859-1 to store this kind of data to see what happens... > > But, definitely, if you specified an unicode database you should have no > problems with your unicode data up to the length of the columns you > specified. Absolutely > It is, to me, another of those really annoying and stupid bugs with MySQL. > Another reason for me to keep it away from my projects. Nah I disagree, MySQL is a great database as long as you are aware of the implications. MySQL tries to be an enterprise-class RDBMS, which it is not, however people who are familiar with it know the real truth: MySQL is blazingly fast BECAUSE of things like this. If you need 100% data integrity and advanced (read: rarely used) functionality then you use PG. If you want "as fast as Oracle" you use MySQL. If you want both, you use Oracle or DB2. MySQL is the PHP of RDBMS, it's great for 99% of uses, but there are fringe cases where another database will be more appropriate. For me, this problem will not stop me using MySQL, I will just use TEXT columns when I want strings longer than 127 characters. It should be important to note, by the way, that this poses a mild risk to applications: Someone could insert corrupt data into the database, which would result in the application crashing with a UnicodeDecodeError every time it tries to select that data. I think, a solution to the crashing would be for SQLObject to encode UnicodeCol characters in to UTF-16, which is a 2-byte character set? So if you had even column lengths, then there is no chance of MySQL truncating the data in the middle of a character. -Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~----------~----~----~----~------~----~------~--~---

