Upgrading ec_transaction failes under PostgreSQL 8.4

jmpoure - August 17, 2009 - 09:36
Project:e-Commerce
Version:6.x-4.x-dev
Component:ec_store
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Upgrading ec_transaction failes under PostgreSQL 8.4:

ec_store module
Update #6412
* ALTER TABLE {ec_transaction} ADD COLUMN allocated numeric(10, 2) NOT NULL default 0
* ALTER TABLE {ec_transaction} ADD COLUMN balance numeric(10, 2) NOT NULL default 0
* Failed: UPDATE {ec_transaction} t SET t.allocated = (SELECT SUM(a.amount) FROM {ec_receipt_allocation} a WHERE a.type = 'transaction' AND a.etid = t.txnid)
* UPDATE {ec_transaction} SET balance = (gross - allocated)

The error comes from a.etid = t.txnid because they are from a different type.
ERROR: The operator does not exist: character varying = integer

MySQL will cast data automatically.
PostgreSQL and SQL99 does not allow to make a join on two different types.

Even if it works in MySQL, I don't think it is safe to make such a cast.

Anyway, I am new to the project, so don't consider my point of view.
The best would be to cast data using standard SQL.

#1

jmpoure - August 29, 2009 - 21:24

Sorry, eCommerce is not installed anylonguer on my system.
I don't have the database here, so I cannot tell which type should be casted

Use CAST (type AS INTEGER).
The solution is pretty easy: http://drupal.org/node/555536 .

I wrote a guide about MySQL and PostgreSQL
in the developer book: http://drupal.org/node/555514

#2

gordon - August 30, 2009 - 00:06
Status:active» fixed

Thanks for the information. I have made the change and I hope that is doesn't cause any other issues.

#3

System Message - September 13, 2009 - 00:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.