Closed (fixed)
Project:
Location
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
9 Nov 2005 at 19:28 UTC
Updated:
19 Dec 2006 at 20:31 UTC
Jump to comment: Most recent file
I've been testing modules on my postgresql based drupal setup, and I have this error when adding the table in location.pgsql (I created this, attached below).
psql:location.pgsql:15: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "location_pkey" for table "location"
psql:location.pgsql:15: ERROR: column name "oid" conflicts with a system column name
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | location_pgsql_20061201_1318_patch.txt | 10.53 KB | sammys |
| #10 | location_pgsql_20061201_1307_patch.txt | 10.37 KB | sammys |
| #1 | location.pgsql.4.7.patch.txt | 9.54 KB | sammys |
| diff_28 | 9.41 KB | toddfries |
Comments
Comment #1
sammys commentedAs already mentioned in this thread, the oid field name is invalid in PostgreSQL and need to be changed or the module will be unusable. Here is a patch for location 4.7 including the update code for the field rename. Please test it on MySQL so we can get this issue dealt with. I'm tired of having to patch the module when I use it.
Cheers,
Sammy Spets
Synerger
http://www.synerger.com
Comment #2
redsky commentedYes, it would be fantastic if this patch was applied!
Comment #3
sammys commentedsince it doesn't work, this bug is critical. redsky: please see if the patch works on your system and post a response so I can get this issue set to 'ready to be committed'.
Comment #4
redsky commentedHi, Sorry but I don't know how to apply a patch. I have the location module working using Drupal 4.7.3 and Postgres 8.0 by manually applying the changes outlined in the patch but I'm not sure I'd trust that as a good test of the patch. Sorry I know applying a patch is probably pretty basic, I'd be willing to help if you could point me in the right direction. I'm familiar with Subversion but not patches in it or CVS.
Comment #5
sammys commentedok.. get the original files for location back again and put the patch file in your drupal site directory. i.e the one with sites and modules directories in it. Then run:
patch -p0 < patchfile.txtThis command doesn't work for every patch because of the -p argument needing variation when patch files are created differently or the directory from which you execute the patch command. Let me know how you go and thanks for pushing your boundaries! :)
Comment #6
bkieser commentedThank you for this patch. I started doing the same work myself, then came across this post. Saved me a lot of time and effort!
Brad
Comment #7
bkieser commentedThe patch creates a problem:
PHP Fatal error: Cannot redeclare location_update_2() (previously declared in /home/drupal/html/modules/location/location.install:98) in /home/drupal/html/modules/location/location.install on line 114
File has this after running the patch:
function location_update_2() {
$configured_countries = variable_get('location_configured_countries', array());
if ($configured_countries['us']) {
$configured_countries['us'] = 'us';
variable_set('location_configured_countries', $configured_countries);
}
}
function location_update_2() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("ALTER TABLE {location} CHANGE oid lid int(10) unsigned NOT NULL default '0'");
break;
case 'pgsql':
break;
}
}
I amended this to be:
function location_update_2() {
$configured_countries = variable_get('location_configured_countries', array());
if ($configured_countries['us']) {
$configured_countries['us'] = 'us';
variable_set('location_configured_countries', $configured_countries);
}
}
function location_update_2() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("ALTER TABLE {location} CHANGE oid lid int(10) unsigned NOT NULL default '0'");
break;
case 'pgsql':
break;
}
}
and it worked perfectly.
Comment #8
sammys commentedSeems the maintainer doesn't like the idea of changing the oid field to lid. Ah well. A new patch needs to be rolled up with the update_2 (supplied by this patch) changed to update_3 and the functions ordered properly. I don't have the time to do this just yet.
Comment #9
sammys commentedsetting it to code needs work
Comment #10
sammys commentedHere is the updated patch for PostgreSQL support. I've changed the oid field to eid as requested by ankur (module maintainer). I've also torn out the (N) additions to integer types in the MySQL schema since they are not needed.
This code needs review by both PostgreSQL and MySQL parties before it's committed. I'll have a look at PostgreSQL after this post is done.
Comment #11
sammys commentedI've added a comment into the location.install file to notify everyone that all updates below the comment must include PostgreSQL support. Patch works in PostgreSQL and is RTBC on my side. Waiting on the MySQL side to be confirmed as working before this will be committed.
Comment #12
ankur commentedI have reviewed this patch and am going to commit it. The only hitch now is that I want to coordinate the column name change with maintainers of a couple of modules that refer to the location schema (and, specifically, the 'oid' column). Once I hear back from them, this will be committed.
Comment #13
ankur commentedThis patch has been committed to DRUPAL-4-7 and HEAD branches.
Comment #14
(not verified) commented