Following error occurs when trying to install the Services module.
PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Column, parameter, or variable #8: Cannot specify a column width on data type int.
The problem sits in one of the field definitions in the hook_schema():
'debug' => array(
'description' => 'Set the endpoint in debug mode.',
'type' => 'int',
'length' => 2,
'not null' => TRUE,
'default' => 0
),
The patch provided performs an extra check so if length exists and the type is int, it is ignored.
Since this is my first patch, I hope I am doing things right. :-)
Comments
Comment #1
sneyerst commentedSince a patch is available, I'll put this in 'needs review' state.
Comment #2
damien tournoud commentedThat's a bug in the Services module, and will likely fail the same on other database engine.
Comment #3
rymoSee #346450: Schema API: 'length' should be ignored on non varchar and char fields from 2009 and note the accepted solution was that each database driver is responsible for deciding how and when to ignore the length field as necessary. From the Schema API:
. Adding a patch to make this check similar to core engines.
Comment #4
rymowrong patch file, here it is
Comment #5
twistor commentedLooks like this patch also touches precision and scale values. That would be a separate issue.
Comment #6
rymounless you're aware of a specific case where 'precision' and 'scale' were successfully applied to SQL field types other than numeric or decimal, this should be a safe patch. the issues are similar and related, and so is the fix.
Comment #7
DrMiaow commentedI was just about to post the same issue. Good to see this is being attended to.
I found this issue with a few other modules as well.
Comment #8
DrMiaow commentedI have also seen this issue with length applied to 'text'
Comment #9
mgiffordWould be great to get this into a future release. I can't test it unfortunately.
Comment #10
damien tournoud commentedI'm not sure I like the hand holding here, but I merged this in 7.x-1.x anyway.