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.
Hello. when i get error in edit geo field setting with openlayer i find this issue and i unistall my geofield 7.1.1 and install geofiled-7.x-1.x-dev. And when i want create new geofield (with each widget) i get this error and redirect to admin/structure/types/manage/mycontenttype/fields
There was a problem creating field myfieldlabel: SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column 'field_myfield_srid' can't have a default value
Comment | File | Size | Author |
---|---|---|---|
#18 | geofield-sql-error-1965484-18.patch | 540 bytes | Jan van Diepen |
#5 | geofield-sql-error-1965484-5.patch | 1.96 KB | guillaumev |
#4 | geofield-sql-error-1965484.4.interdiff.txt | 656 bytes | larowlan |
#4 | geofield-sql-error-1965484.4.patch | 1.88 KB | larowlan |
#2 | sql_error-1965484-2.patch | 1.88 KB | guillaumev |
Comments
Comment #1
drupalion CreditAttribution: drupalion commentedresolved problem with update to geofiled-7.x-2.x-dev
Comment #2
guillaumev CreditAttribution: guillaumev commentedNote that this problem is caused by http://drupal.org/node/1942826. Here is a patch which fixes and adds an update function for existing fields, update function which had not been added in http://drupal.org/node/1942826.
Comment #3
larowlanThis throws an erro
Comment #4
larowlanPatch at #2 has incorrect use of SelectQuery::fields method
Fix attached.
Comment #5
guillaumev CreditAttribution: guillaumev commentedThanks for fixing my patch :-) ! Here is a new one which fixes a warning that shows when there is no content to update... (through a if (!empty($values)) ).
Comment #6
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedI can confirm that patch in #5 is working properly.
Thank you very much! :-)
Comment #7
radimklaska#5 worked for me. Thanks!
Comment #8
Brandonian CreditAttribution: Brandonian commented#5 committed to both 1.x and 2.x branches. Thanks, @larowlan and @guillaumev!
7.x-1.x - http://drupalcode.org/project/geofield.git/commit/1756445
7.x-2.x - http://drupalcode.org/project/geofield.git/commit/599ec51
Comment #9
mraichelson CreditAttribution: mraichelson commentedStill coming across this error when trying to update a site from 7.x-1.1 to latest 7.x-2.x-dev here.
Comment #10
mraichelson CreditAttribution: mraichelson commentedAfter a bit of poking around: commenting out geofield_update_7100() clears up this issue when trying to upgrade.
Since 7100 changes the field type of the srid field which seems to be what's freaking out (at least for me) and then 7202 eliminates it as a field entirely can 7100 be removed?
(Glad to put together a patch, just want to double-check on what's doing what.)
Comment #11
grota CreditAttribution: grota commentedYeah, I can confirm the upgrade path is broken because of geofield_update_7100(), deleting it fixes the problem
Comment #12
TwoDUpdate 7100 does exactly what a schema update MUST NOT do, it reuses the CURRENT schema definition in an old update.
If you try to update from an early 7.x-1.x state to a late 7.x-2.x, the schema will have changed drastically. You MUST copy the old schema (or the relevant parts of it) into the update functions or the result becomes very unpredictable. In my case, I had to extract the old schema from a 7.x-1.x version and remove the
$schema = geofield_field_schema(array());
line and use this instead:Comment #13
thelee CreditAttribution: thelee commentedTwoD in #12 is exactly right - this issue completely broke down one of our sites. there's a slight typo in his code, though, should be (missing a paren):
can anyone more knowledgeable comment if simply swapping out the schema line with this is a sufficient change for a patch? that's what I did and it got our site/update working fine again, but don't know if this would lead to unintentional side effects.
Comment #14
Christopher Riley CreditAttribution: Christopher Riley commentedYes this resolved the issue that I had doing the upgrade to the latest dev version.
Comment #15
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedThe above fix in 13 worked.
Otherwise I get the following:
drush updatedb
The following updates are pending:
geofield module :
7100 - Changing srid from int to text
7200 - Change geofield lat, lon, left, top, right and bottom from floats to numeric fields with precision of 18 and scale of 12.
7201 - Converts the wkt field into a geom field. Converts already existing data from wkt storage to wkb. Much inspiration for this implementation comes from taxonomy_update_7005.
7202 - Drops unused table fields srid, accuracy and source, adds geohash field, populates it.
Do you wish to run all pending updates? (y/n): y
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server[error]
version for the right syntax to use near 'DEFAULT NULL' at line 1
Finished performing updates.
Comment #16
Brandonian CreditAttribution: Brandonian commentedGood catch, @TwoD and @thelee. Apologies for taking a bit to fix this, but I've committed a change to the original update hook based on @TwoD's comments in 13.
http://drupalcode.org/project/geofield.git/commit/fce2c4f
Comment #18
Jan van Diepen CreditAttribution: Jan van Diepen commentedI'm upgrading from 7.x-1.0 to 7.x-2.1 and am having the issue described in https://drupal.org/node/2057485:
In case the table to be updated has no entries the following lines of code in geofield_update_7100()
returns a non-empty object.
Changing the conditional statement two lines down the code from
if (!empty($values)) {
to
if (!empty($values) && (count($values) > 0)) {
solved it for me.
Attached is a patch against the current 7.x-2.x branch.
Comment #19
Jan van Diepen CreditAttribution: Jan van Diepen commented