Found this one trying to install the 'Image Picker' module. Looks like it creates a table with an unsigned column called 'public', which ends up with the following definition currently:

[public] smallint NOT NULL CONSTRAINT drupal_imagepicker_user_groups_public_df DEFAULT 0 CHECK (public >= 0)

This breaks as public is a keyword, so I've added a patch to wrap the column inside the CHECK with square brackets to prevent this:

[public] smallint NOT NULL CONSTRAINT drupal_imagepicker_user_groups_public_df DEFAULT 0 CHECK ([public] >= 0)

Sorry, bit of a contrib. newbie so hopefully this is done correctly! Cheers

Comments

nitram2000’s picture

Status: Needs review » Reviewed & tested by the community

The patch works fine - it also fixes the installation problems for workbench_moderation: http://drupal.org/node/1260112

Best regards,

Martin

hass’s picture

Typically we don't use reserved sql column names or other trouble makers in drupal. We avoid this also for mysql. Date module and core have such a piece of code just for a mysql bug in one mysql version.

See #395156: MySQL 5.0.67: Table 'drupal6.date_format' not created

xenphibian’s picture

I had created a patch similar to this one (with a couple of other changes) that also fixes the schema problems with Private Email module (privatemsg).

@hass Yes, one should avoid using known keywords, but we can't all know every keyword of every future database.

omegamonk’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

@CapBBeard: Thanks for the patch. I just made a commit from #1830024: Cannot execute db_change_field() to convert nvarchar to varbinary for this very issue. Closing as duplicate.