Closed (won't fix)
Project:
GeSHi Filter for syntax highlighting
Version:
6.x-1.3
Component:
GeSHi node (submodule)
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Feb 2010 at 16:47 UTC
Updated:
12 Mar 2010 at 10:58 UTC
Comments
Comment #1
soxofaan commentedI don't have access to a setup with PostgreSQL, so it's a bit hard to dive into this.
The message you cited mentions both "warning" and "error". I wonder if it the update really failed (meaning that it stopped updating after the error) or just raised a warning and continued the rest of the update.
This is the update function that is responsible for the database update we are talking about:
The error/warning is from the following line I guess:
Can you check if the following database updates were executed:
E.g.: is there a primary key on 'vid' in the 'geshinode' table and is there an index on 'nid'?
Comment #2
lifepillar commentedis there a primary key on 'vid' in the 'geshinode' table and is there an index on 'nid'?
Yes. I guess that the error comes from the order in which db_drop_primary_key() and db_change_field() are called. See http://api.drupal.org/api/function/db_change_field/6, in particular:
Since db_change_field() causes the primary key to be dropped, when you call db_drop_primary_key() there is no primary key to be removed. So, the error is innocuous (the other changes are applied), and it might be easily fixed by exchanging the order of those two function calls.
Comment #3
soxofaan commentedSorry for the delay, but I didn't had the time to look into this in more depth.
Changing the update to
does not work on MySQL.
The drop of primary key on "geshinode.nid" fails with message:
Explanation: before the update, geshinode.nid was of type "serial" (aka autoinrement) instead of "int" and had a primary index on it. Apparently in MySQL, if you have an autoincrement column, it has too be primary key too. So you can't drop the index before changing it from serial to int (maybe this is the case in PostgreSQL too?). That's why
db_change_field()has to come beforedb_drop_primary_key().Also note that because the dropping of the primary key on "geshinode.nid" failed, the adding of (a second) primary key on vid also fails:
with
One option is to put a database specific test around the
db_drop_primary_key():However I don't like database specific code (makes it harder to test things, and it assumes a behavior of postgreSQL that could change in the future). So the other option, which I am more inclined to is flagging this issue as "wont't fix".
The current update function works on both MySQL and PostgreSQL. With PostgreSQL, you get a warning/error message, but as you reported, it is safe to ignore this.
For now, I'd set this (rather minor) issue to "won't fix". If you disagree, I'm open to discuss this further.