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

Files: 
CommentFileSizeAuthor
#4 1732436.patch866 bytesvalthebald

Comments

valthebald’s picture

Version:7.x-2.5» 7.x-2.x-dev

Currently I don't have postgresql installation by hand, so if anyone can point out correct syntax for it, that would be great

dexlab’s picture

I'm having the same problem using Postgres 8.4

katrin_koehler’s picture

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)');
valthebald’s picture

Status:Active» Needs review
StatusFileSize
new866 bytes

Something like attached patch?

ncouraud’s picture

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)');
valthebald’s picture

Maybe the right solution will be perform problematic patch only for mysql users?

valthebald’s picture

Status:Needs review» Fixed

Fixed by checking database driver type (and performing operation only for mysql)

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.