Download & Extend

PostgreSQL doesn't do multiple-row INSERTs until Drupal 7

Project:Ubercart
Version:6.x-2.0-rc3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I installed Ubercart and got the following:

warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "," at character 91 in /var/www/sites/cart/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO uc_zones (zone_country_id, zone_code, zone_name) VALUES (840, 'AL', 'Alabama'),(840, 'AK', 'Alaska'),(840, 'AS', 'American Samoa'),(840, 'AZ', 'Arizona'),(840, 'AR', 'Arkansas'),(840, 'AF', 'Armed Forces Africa'),(840, 'AA', 'Armed Forces Americas'),(840, 'AC', 'Armed Forces Canada'),(840, 'AE', 'Armed Forces Europe'),(840, 'AM', 'Armed Forces Middle East'),(840, 'AP', 'Armed Forces Pacific'),(840, 'CA', 'California'),(840, 'CO', 'Colorado'),(840, 'CT', 'Connecticut'),(840, 'DE', 'Delaware'),(840, 'DC', 'District of Columbia'),(840, 'FM', 'Federated States Of Micronesia'),(840, 'FL', 'Florida'),(840, 'GA', 'Georgia'),(840, 'GU', 'Guam'),(840, 'HI', 'Hawaii'),(840, 'ID', 'Idaho'),(840, 'IL', 'Illinois'),(840, 'IN', 'Indiana'),(840, 'IA', 'Iowa'),(840, 'KS', 'Kansas'),(840, 'KY', 'Kentucky'),(840, 'LA', 'Louisiana'),(840, 'ME', 'Maine'),(840, 'MH', 'Marshall Islands'),(840, 'MD', 'Maryland'),(840, 'MA', 'Massachusetts'),(840, 'MI', 'Michigan'),(840, 'MN', 'Minnesota'),(840, 'MS', 'Mississippi'),(840, 'MO', 'Missouri'),(840, 'MT', 'Montana'),(840, 'NE', 'Nebraska'),(840, 'NV', 'Nevada'),(840, 'NH', 'New Hampshire'),(840, 'NJ', 'New Jersey'),(840, 'NM', 'New Mexico'),(840, 'NY', 'New York'),(840, 'NC', 'North Carolina'),(840, 'ND', 'North Dakota'),(840, 'MP', 'Northern Mariana Islands'),(840, 'OH', 'Ohio'),(840, 'OK', 'Oklahoma'),(840, 'OR', 'Oregon'),(840, 'PW', 'Palau'),(840, 'PA', 'Pennsylvania'),(840, 'PR', 'Puerto Rico'),(840, 'RI', 'Rhode Island'),(840, 'SC', 'South Carolina'),(840, 'SD', 'South Dakota'),(840, 'TN', 'Tennessee'),(840, 'TX', 'Texas'),(840, 'UT', 'Utah'),(840, 'VT', 'Vermont'),(840, 'VI', 'Virgin Islands'),(840, 'VA', 'Virginia'),(840, 'WA', 'Washington'),(840, 'WV', 'West Virginia'),(840, 'WI', 'Wisconsin'),(840, 'WY', 'Wyoming') in /var/www/sites/cart/sites/all/modules/ubercart/uc_store/countries/united_states_840_1.cif on line 74.
warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "," at character 91 in /var/www/sites/cart/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO uc_zones (zone_country_id, zone_code, zone_name) VALUES (124, 'AB', 'Alberta'),(124, 'BC', 'British Columbia'),(124, 'MB', 'Manitoba'),(124, 'NF', 'Newfoundland'),(124, 'NB', 'New Brunswick'),(124, 'NS', 'Nova Scotia'),(124, 'NT', 'Northwest Territories'),(124, 'NU', 'Nunavut'),(124, 'ON', 'Ontario'),(124, 'PE', 'Prince Edward Island'),(124, 'QC', 'Quebec'),(124, 'SK', 'Saskatchewan'),(124, 'YT', 'Yukon Territory') in /var/www/sites/cart/sites/all/modules/ubercart/uc_store/countries/canada_124_1.cif on line 22.

Comments

#1

I thought this had been fixed long ago, but I guess not. Here's the old issue, which explains what the problem is: http://drupal.org/node/224070#comment-738719

#2

Status:active» closed (duplicate)

Reopened the more descriptive issue and closing this'n.

#3

Status:closed (duplicate)» active

Nope, that issue only had this problem tacked onto it after the first problem was fixed. Then it was closed automatically and everyone (including the original poster, apparently) forgot about it.

So let's get this fixed here.

#4

Title:Ubercart doesn't fully support PostgreSQL» PostgreSQL doesn't do multiple-row INSERTs

For clarity.

#5

Maybe my version of PostgreSQL (8.1.11-1.el5_1.1) doesn't support multiple row inserts, but it looks like recent versions do. So your changed title may not be too accurate.

#6

Title:PostgreSQL doesn't do multiple-row INSERTs» PostgreSQL doesn't do multiple-row INSERTs until Drupal 7

Fair enough, but Drupal 6 only requires PostgreSQL 7.4 or higher, most of which don't support multiple row inserts.

#7

Status:active» needs review

Ugh, that's a lot of files. Here's Canada and the United States, since those are imported automatically. I tried writing a sed script to handle the rest, but I couldn't get it to work right. It's getting so that I can do each file manually faster than figuring it out.

But I won't right now. Here's the changes to these two countries. I'll try to get some more done as I find time and motivation, but help would be appreciated.

AttachmentSizeStatusTest resultOperations
insert_zones_ca_us.patch7.64 KBIgnored: Check issue status.NoneNone

#8

I'll see if I can get sed to do the magic.

#9

Sed did the magic. :) Patch attached.

AttachmentSizeStatusTest resultOperations
509312_200907111646-0400.patch214.89 KBIgnored: Check issue status.NoneNone

#10

Priority:normal» critical

Since it's a stopper for anyone using PostgreSQL marking as critical.

#11

Status:needs review» fixed

The patch didn't apply to Bermuda or Nigeria, but now I can't find a difference between the diffs after I manually changed them.

I also fixed Australia and Austria because the country IDs would be interpreted as octal numbers, which would cause some great confusion.

Thanks, Sammy, for knowing sed better than me. Committed with those changes.

AttachmentSizeStatusTest resultOperations
509312_pg_countries.patch200.86 KBIgnored: Check issue status.NoneNone

#12

Status:fixed» closed (fixed)

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

nobody click here