Posted by snovak7 on August 15, 2012 at 10:28am
6 followers
| Project: | Meta tags quick |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
metatags_quick module
Update #7004
Failed: PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "PRIMARY" LINE 1: ALTER TABLE metatags_quick_path_based DROP PRIMARY KEY, ADD ... ^: ALTER TABLE {metatags_quick_path_based} DROP PRIMARY KEY, ADD PRIMARY KEY (`id`); Array ( ) in metatags_quick_update_7004() (line 121 of /var/www/d7/sites/all/modules/metatags_quick/metatags_quick.install).
NOTE that I'm using PostgreSQL 9.0, which it seems is for mysql database script, and not for pgsql
Comments
#1
Currently I don't have postgresql installation by hand, so if anyone can point out correct syntax for it, that would be great
#2
I'm having the same problem using Postgres 8.4
#3
I solved this issue by changing the code in metatags_quick.install in Line 121. The syntax is not working with Postgres like it should, because PRIMARY KEY can't be dropped like this. PRIMARY KEY (`id`) has to be replaced by PRIMARY KEY (id).
- db_query('ALTER TABLE {yourTableName} DROP PRIMARY KEY, ADD PRIMARY KEY (`id`)');+ db_query('ALTER TABLE {yourTableName} DROP CONSTRAINT {yourTableName}_pkey, ADD PRIMARY KEY (id)');
#4
Something like attached patch?
#5
That patch only solves the Syntax issue for those using postgres. MSSQL users will have the same issue as well, here's the syntax for that:
db_query('ALTER TABLE {metatags_quick_path_based} DROP CONSTRAINT {metatags_quick_path_based}_pkey; ALTER TABLE {metatags_quick_path_based} ADD CONSTRAINT {metatags_quick_path_based}_pkey PRIMARY KEY CLUSTERED (id)');#6
Maybe the right solution will be perform problematic patch only for mysql users?
#7
Fixed by checking database driver type (and performing operation only for mysql)
#8
Automatically closed -- issue fixed for 2 weeks with no activity.