Closed (fixed)
Project:
Ubercart
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
16 Nov 2009 at 10:14 UTC
Updated:
15 Mar 2010 at 01:40 UTC
Jump to comment: Most recent file
I have uc_store version 2009-10-30
I have had Ubercart for a while and whenever you changed the country column country_id from a SERIAL to an INTEGER, it moved from being first to being last in the table. It is always like that in PostgreSQL when you add a new column, copy the old to the new and then remove the old. Anyway... This means using an INSERT without specifying the column names fails.
Table "public.uc_countries"
Column | Type | Modifiers
--------------------+------------------------+----------------------------------------
country_name | character varying(255) | not null default ''::character varying
country_iso_code_2 | character(2) | not null default ''::bpchar
country_iso_code_3 | character(3) | not null default ''::bpchar
version | smallint | not null default 0
country_id | int_unsigned | not null
Indexes:
"uc_countries_pkey" PRIMARY KEY, btree (country_id)
"uc_countries_country_name_idx" btree (country_name)
The following works:
function chile_install() {
// VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES (152, 'Chile', 'CL', 'CHL', 1)");
[...]
The patch is a fix for all the countries.
Thank you.
Alexis Wilke
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | ubercart-saudi_arabia-6.x.patch | 713 bytes | AlexisWilke |
| #6 | ubercart-saudi_arabia-6.x.patch | 713 bytes | AlexisWilke |
| #2 | ubercart-import_countries-6.x.patch | 80.73 KB | AlexisWilke |
| addresses-6.x-1.x-edit-address-book.patch | 2.21 KB | AlexisWilke |
Comments
Comment #1
Island Usurper commentedIs that maybe the wrong patch?
Comment #2
AlexisWilke commentedWell... there is indeed a remote chance that was the wrong patch... 8-)
Comment #3
tr commentedThe column type was changed in #610664: country_id declared as serial; isn't.
Does this issue affect *new* installations on PostgreSQL or just upgrades from a previous UC version? From your description it sounds like it was the db_change_field() call (i.e. ALTER TABLE) in uc_store_update_6005() that resulted in the column order being changed, so new installations should be safe.
The documentation on how to create a .cif file will also have to change, and a bug report will have to be filed against all contributed .cifs ...
Comment #4
tr commentedI tested the patch on MySQL to make sure it didn't break anything. I also fixed algeria_12_1.cif, bahrain_48_2.cif, and pakistan_586_1.cif, which weren't included in your patch.
Comment #5
AlexisWilke commentedHi TR,
The problem could occur again on other upgrades, but yes, it only appeared on upgrades (after the call to the db_change_field()). Now I agree that the order should not be changed, but that's how PostgreSQL does it... We have no control over it. In all circumstances, it is much safer to have the column names repeated to make sure you don't get an error.
And the additional countries, I think, were not included in the version I had at the time I generated the patch. Thank you for taking care of those.
Alexis
Comment #6
AlexisWilke commentedLooks like Saudi Arabia was missed in our patches...
Comment #7
AlexisWilke commentedSorry, the previous patch is inverted!
There is the correct one:
Comment #8
tr commentedThanks for catching that. Committed.
Comment #9
tr commented