We recently installed CRM Core on a drupal site running PostgreSQL, and on activation we got the following:
PDOException: SQLSTATE[42701]: Duplicate column: 7 ERROR: column name "ctid" conflicts with a system column name: CREATE TABLE {crm_core_match_contact_types} ( ctid serial CHECK (ctid >= 0), contact_type varchar(32) NOT NULL, threshold int CHECK (threshold >= 0) NOT NULL default 0, status smallint NOT NULL default 0, strict smallint NOT NULL default 0, return_order varchar(32) NOT NULL, PRIMARY KEY (ctid) ); Array ( ) in db_create_table() (line 2720 of /home/site1/public_html/includes/database/database.inc).
The problem is that 'ctid' is a reserved field name in PostgreSQL, and the crm_core_match_contact_types table uses that for the id column. A quick grep seems to show that ctid isn't referenced anywhere in CRM Core code other than in the .install file. Anyone know if one of the extension modules uses it?
I'm inclined to change the field name to 'ct_id'. Any other suggestions? A patch will follow once I get a test site on MySQL set up to test the upgrade code.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | crm_core-Rename_field_ctid_to_ct_id-2496619-1.patch | 1.89 KB | ben coleman |
Comments
Comment #1
ben coleman commentedAttached is a patch that fixes the above problem. This changes the field name to ct_id, and includes .install file update code to rename the field on an update. I put up a test MySQL site and the update appears to work, but it wouldn't hurt if someone more familiar with MySQL tested it, too (we're exclusively a PostgreSQL shop).
Comment #3
rosk0Fixed.
Thanks!