Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the path in which a string is found for the first time is longer than 255 it get truncated in mysql and cause an error in pgsql.
255 is too short and anyway there should be a more uniform treatment of max URL length in all drupal.
see:
problem is present in 5.X and 6.X
Comment | File | Size | Author |
---|---|---|---|
#57 | 221020_locale_location_D6.patch | 1.31 KB | vectoroc |
#53 | openid_locale_bug.png | 195.65 KB | wojtha |
#41 | 221020_locale_location_D6.patch | 1.33 KB | andypost |
#38 | 221020_locale_location_D6.patch | 1.33 KB | andypost |
#35 | 221020_locale_location.patch | 802 bytes | andypost |
Comments
Comment #1
Gábor HojtsyWell, we could strip the string in Drupal and only save a 255 char long substring. The location field is not designed to provide you with accurate information. It only collects the first place the string occurred, which could be quite random. Also, if you import a .po file, it could have several lines of occurrence information, which is also truncated. I understand this causes an error in postgresql, so I'd say we should trim the value. (Drupal 5 and 6 would not receive database changes anyway).
Comment #2
ivanSB@drupal.orgI was checking if there was any pg issue I could fix and stumbled again into this.
Why are you going to avoid changes in DB? It'd be just an alter table (I do think 255 is a bit too short) or a trim in php.
There is a similar problem in watchdog too.
Accurate information it is actually very useful once you need to check the context of the translation actually.
Does it has any chance to get into 7 together with the watchdog patch?
How can I help to get this at least into 7?
thx
Comment #3
Gábor HojtsyWe do not avoid database changes in Drupal 7, we do avoid database changes if at all possible with stable versions (Drupal 5 and 6) to keep compatibility with existing modules.
Comment #4
ivanSB@drupal.orgOK...
BTW the watchdog problem seems serious enough to justify a DB change. I wander what kind of compatibility problems may arise from enlarging the field and trimming.
After all mysql already does that.
I'll try to check same issues as soon as I've 5 min to install 7.
thanks
Comment #5
andypostThis bug targeted both d6 and d7 same as #107824: Convert {watchdog}.referer and {accesslog}.url from VARCHAR to TEXT
Quick patch for both branches
Comment #7
nedjoWhile the location field is fairly arbitrary for the 'default' textgroup (managed by core's t() function), and so could be safely truncated, it's used for other purposes in contrib for other textgroups. The i18nstrings module uses it to concatenate an array of keys identifying a string. I don't know of any cases where the resulting string is longer than 255 characters, but if it was we couldn't truncate without losing data.
Comment #8
andypost@nedjo a lot of short strings already longer, for ex
select * from locales_source where source = 'delete';
returns:
includes/locale.inc:86,2006; modules/block/block.admin.inc:79; modules/book/book.admin.inc:238; modules/comment/comment.module:826; modules/contact/contact.admin.inc:16; modules/filter/filter.admin.inc:35; modules/menu/menu.admin.inc:100; modules/node/co
which as you can see truncated by mysql
so there are only 2 solutions - truncate (now) or make this field text-type as #107824: Convert {watchdog}.referer and {accesslog}.url from VARCHAR to TEXT
Comment #9
Damien Tournoud CreditAttribution: Damien Tournoud commentedLet's go with a TEXT field.
Comment #10
andypostSuppose first should be patched 6-dev version then follow-up for D7
Comment #12
andyposttracking cvs HEAD
Comment #14
andypostComment #15
andypostStrange syntax error - patch is trivial so next review
ps last comment lost body and status change
Comment #16
cburschkaIt seems that the testbot missed this issue. I've submitted a retest of the last failed patch as I can't see it causing a syntax error.
Comment #17
andypostSo here is reroll
Comment #18
andypostAnother reroll after #473366: DBTNG locale.module
Comment #19
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks. Lowering version.
Comment #20
andypostfrom IRC
22:45 Dries__: andypost: in d6, we just want to truncate the url, imo, so we don't have to change the schema
So here the old patch
Comment #21
Josh Waihi CreditAttribution: Josh Waihi commentedI have to agree with Damian on this one. We should go with a TEXT field here rather than cutting the location short, there is no point in having a location if you can't use it to locate anything. Once this is done we can do what we did over at #107824: Convert {watchdog}.referer and {accesslog}.url from VARCHAR to TEXT and write a patch for 7 to support the upgrade.
Comment #22
andypostSo waiting Gábor Hojtsy's review!
Comment #23
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #24
miurahr CreditAttribution: miurahr commentedThere is a same problem on D6's locale.module:378;
When using OpenID module with yahoo.com which returns over 255 byte uri, this part of code occurs error.
Comment #25
andypostSo here fix with changing table
locales_source.location
to TEXTlocation size could be very long see http://drupal.org/node/107824#comment-1693226
Let's make a Db change in d6
Comment #26
sage-2 CreditAttribution: sage-2 commentedSame path but for D6.13
Comment #27
andypost@sage don't change version
there are 2 ways - truncate string and change database field to TEXT type
Comment #28
Josh Waihi CreditAttribution: Josh Waihi commentedI'm going with andypost's patch here.
Comment #29
Gábor HojtsyThis is not in fact in Drupal 7 anymore due to #278592: Sync 6.x extra updates with HEAD, which removed D5 -> D6 update functions. There were two issues with andypost's patch which resulted it being removed:
1. It was a new 6xxx update function committed to Drupal 7. A big no-no. If you aim for Drupal 7, add 7xxx update functions.
2. The 6xxx update function was in the 5.x to 6.x update group, which is inevitably removed in D7. It should be in a 6-extra group in D6 even (and a 7.x group in 7.x, see (1)).
Similar reasons necessitated a follow up patch in http://drupal.org/node/107824#comment-2038438 for example.
So let's get this back again in Drupal 7 and then 6 (and then update 7 again).
Comment #30
hass CreditAttribution: hass commentedI've got this issue on Drupal 6.14 with MySQL 5.x after enabling a theme, too. This is not limited to PostgreSQL. Removing wrong tagging.
Comment #31
andypostD7 branch have comment but actually no update happen!
Comment #32
andypost@Gábor Hojtsy #334283: Add msgctxt-type context to t() is raised for upgrade path, so let's make a change in D6 and then change D7 upgrade path
So I leave this postponed till is not fixed #334283: Add msgctxt-type context to t()
Comment #33
andypostNow patch for D6 with changed schema (forget in previous)
Comment #34
andypostSo this could be commited to 6
Comment #35
andypostLocation was lost again
Comment #36
andyposttaggin
Comment #37
andypost#33 should wait til #278592: Sync 6.x extra updates with HEAD
Comment #38
andypostUpgrade path for D7 locale_update_7000() fixed in #278592: Sync 6.x extra updates with HEAD
So lets solve this for D6!
Comment #39
andypostThis error caused by mysql settings, some systems have this by-default
http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_stri...
http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_stri...
Let's backport this change because D6 supports mysql 5.0
patch from #38 still valid
Comment #40
cburschkaPretty sure that you shouldn't leave a blank line between PHPdoc and function. Other than that, looks good to go.
I'm on crack. Are you, too?
Comment #41
andypost@Arancaytar thanx a lot for review!
Fixed patch.
Comment #42
nimi CreditAttribution: nimi commentedPatch Failed for me.
I'm using Drupal 6.13.
Here's the error:
This is a Mysql related error. Here's the solution I found (from here):
What would you suggest I do?
Thanks, Nimi.
Comment #43
andypost@nimi Please check keys for your {locales_source} table first. As you can see http://api.drupal.org/api/function/locale_schema/6 there's only 2 keys (lid and source).
Suppose your installation have modified DB
Comment #44
andypostMarked as duplicate #279219: Grave bug: MySQL trims and destroys data
Comment #45
killua99 CreditAttribution: killua99 commentedI solve the problem for the 221020_locale_location_D6_2.patch with this.
Comment #46
Gábor HojtsyI'm intrigued at how @killua99 and @nimi had the same issue with the DB independently? What would add the textgroup_location index? i18nstrings.module? (Which actually uses the location and textgroup fields to look up stuff, so would be logically indexing them). I'm reluctant to commit this change due to the potential to break stuff as it showed by two reviewers already. Can we figure out why this breaks for some people even though the core schema does not have an affected index?
Comment #47
andypostI file an issue #803380: locales_source.location index
Comment #48
andypostAnother reason to commit this a _locale_rebuild_js() which query uses
WHERE s.location LIKE '%%.js%%'
so location could be truncated and we never get JS-strings translatedAlso there's amazing related issue #504506: Drupal.formatPlural incorrectly handle complex plural rules
Comment #49
andypostThere's a patch waiting for review in i18n queue #803380-1: locales_source.location index
If this fixed we could proceed with D6 fix
Also there's a discussion about plurals which could be fixed #532512: Plural string storage is broken, editing UI is missing
Comment #50
willmoy CreditAttribution: willmoy commentedRemoving D7 upgrade path tag
Comment #51
jhedstromSubscribe.
Comment #52
wojtha CreditAttribution: wojtha commentedRan today in this issue too with Drupal 6.22 when trying how Drupal handles OpenID failed login - similar to @miurahr in #24
Comment #53
wojtha CreditAttribution: wojtha commentedJust wondering why this isn't fixed in D6 for more than two years being classified as critical... See in attchment how nice is the localized D6 user register page after failed Openid Login...
Comment #54
Gábor HojtsyMarked #232589: "Data too long for column" and "Duplicate entry" a duplicate.
Comment #55
crea CreditAttribution: crea commentedSubscribing
Comment #56
roseryn CreditAttribution: roseryn commentedSubscribing to this as well. Any progress?
Comment #57
vectoroc CreditAttribution: vectoroc commentedrerolled patch against head
also I've added instruction to drop i18nstring's indexes on location_source table as of it causes update fail
Comment #58
killua99 CreditAttribution: killua99 commentedwhat happens if the module doesn't exists?
Comment #59
vectoroc CreditAttribution: vectoroc commentedthen all will be ok
Comment #60
vectoroc CreditAttribution: vectoroc commentedI don't know how to solve right problem with i18nstrings
May be someone can suggest something ?
Comment #61
sarxos CreditAttribution: sarxos commentedHi,
Will it be merged into official repo? I'm facing this issue in my D6 installation.
Comment #62
vandam-me CreditAttribution: vandam-me commented#57: 221020_locale_location_D6.patch queued for re-testing.
Comment #63
vandam-me CreditAttribution: vandam-me commented#35: 221020_locale_location.patch queued for re-testing.