WD php: PDOException: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "clientside_validation_settings_clientside_validation_settings_f" [error]
already exists: CREATE INDEX "clientside_validation_settings_clientside_validation_settings_form_id_type_idx" ON {clientside_validation_settings}
("form_id", "type"); Array
(
)
Names in Postgres have a length limit, when installing the module, these limits get exhausted since the install creates indexes that are prefixed thus resulting in "clientside_validation_settings_clientside_validation_settings_f"
Omitting the additional prefix of the module name solves this issue, patch attached
Comment | File | Size | Author |
---|---|---|---|
#12 | 2355509-12-1.x.patch | 2.79 KB | oliverde |
Comments
Comment #1
DrColossos CreditAttribution: DrColossos commentedpatches for 1.x and 2.x
Comment #2
DrColossos CreditAttribution: DrColossos commentedforgot a change, re-attaching
Comment #3
DrColossos CreditAttribution: DrColossos commentedComment #4
DrColossos CreditAttribution: DrColossos commentedComment #5
attiks CreditAttribution: attiks commentedThanks for the patch, but we need an update function as well, can you add one?
Comment #6
DrColossos CreditAttribution: DrColossos commentedsure, sorry for overlooking this. not used to do something in the _install hook
Comment #7
attiks CreditAttribution: attiks commentedYou need to add an update function, no need to change hook_install, see http://cgit.drupalcode.org/clientside_validation/tree/clientside_validat... for an example. So yours has to be named
clientside_validation_update_7106
Comment #8
DrColossos CreditAttribution: DrColossos commentedI know how they work, I just never wrote one ;) But thanks for the heads-up, appreciate it anways!
But here is the thing:
I have actually 2 indexes in my "clientside_validation_settings" table
Notice how "clientside_validation_settings_clientside_validation_settings_f" should actually be "clientside_validation_clientside_validation_settings_form_id" and "clientside_validation_clientside_validation_settings_form_id_type". This caused an error during install. I ignored this error since everything seemed to work fine.
Additionally, due the error, the system_version column inside the system table was not set. In my case, it looks like this
"sites/all/modules/clientside_validation/clientside_validation.module";"clientside_validation";"module";"''";1;0;-1;0;""
Notice the "-1"; this is the schema column. If I uninstall the module, delete the table from the database, make the schema changes from the previous patches, everything installs fine. The system.schema_version gets correctly set to 7005 as defined in your module.
I'm not sure, how to write the update hook since the system won't run my update hook. I attached a (pretty untested) patch, since I cannot run it with the default installation of it. I think this will work after the system.schema_version gets set properly. Not sure how to do this.
I'm happy to do the same for the 2.x branch after the problem with the system table has been cleared.
*update* I just changed the system.schema_version manually inside the database, and the update ran just fine. I now have the 3 indexes as supposed to.
Comment #9
attiks CreditAttribution: attiks commentedI'll try to review it tomorrow
Comment #10
Jibus CreditAttribution: Jibus commentedEncourting the same issue.
Comment #11
oliverde CreditAttribution: oliverde commentedhaving the same issue as well, patch works well
Comment #12
oliverde CreditAttribution: oliverde commentedPath in the patch was wrong fixed.
Comment #13
Juterpillar CreditAttribution: Juterpillar at Catalyst IT commentedHad the same issue. Thanks for the patch.
Comment #14
DrColossos CreditAttribution: DrColossos commentedany progress on review?
Comment #15
ElusiveMind CreditAttribution: ElusiveMind commentedI can confirm that the patch #12 does resolve the install issue with Postgres.
It's worth noting that this same issue exists in the 2.x branch of this module as well and will need to be addressed there as well.
Comment #16
ElusiveMind CreditAttribution: ElusiveMind commentedComment #17
nikunjkotechaDid anyone get a chance to review this with module already installed? (verify the update hook)
I apologise for not pushing this right away, it is very old and I don't have the time or resources, there are no tests cases too to validate. I'll close as outdated for now but if someone working on a D7 site still can validate the update hook, please reopen with your findings and I'll merge if all good.