when running update.php after updating to ubercart2.0-beta5 I got the following error:

* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "AS" at character 24 in /includes/database.pgsql.inc on line 139.
* user warning: query: UPDATE uc_product_kits AS pk JOIN uc_products AS p ON pk.product_id = p.nid SET pk.discount = pk.discount - p.sell_price WHERE pk.discount >= 0 in /sites/all/modules/ubercart/uc_product_kit/uc_product_kit.install on line 189.

The cause: table-aliases in update-statements are not supported by PostgreSQL

I think (but please correct me if I'm wrong) that this is a working alternative for PostgreSQL:

UPDATE uc_product_kits SET discount = discount - (select p.sell_price from uc_products p join uc_product_kits pk on pk.product_id = p.nid where pk.discount >= 0);

bye,
Robert

Comments

agojc’s picture

The update is simply not recognized. System keeps on warning for installation of beta5 version, even after files have been replaced. It's the same with the download from Ubercart site. Seems as though a beta4 version has been renamed beta5 by mistake !
Runing update.php gave absolutely nothing in my case, neither alert, nor warning of any kind (using MySql).

Dev snapshot has the same problem !

Hope this can help.

Regards,
Jc

Edit : made it work at last, had to erase Ubercart folder before replacing it with the upgrade's content. Then the db had to be updated, which worked fine.

rszrama’s picture

Issue tags: +PostgreSQL
cha0s’s picture

Can I get a witness?

cha0s’s picture

Version: 6.x-2.0-beta5 » 6.x-2.x-dev
Assigned: Unassigned » cha0s
Status: Active » Needs review
rszrama’s picture

Getting some breakfast but wanted to ask real quick if you tested the proposed query in MySQL, too.

cha0s’s picture

StatusFileSize
new1.24 KB

I've been having some issues testing this with pgsql, since there is some kind of _pkey error (this issue seems to be the one: #330451: Cannot post after upgrade to 6.6) I'm in the process of updating so I can test, but if someone else could test this, that'd be great. Unfortunately (to answer your question, Ryan) that query did break in MySQL.

Since I'm not an SQL guru I went ahead and split the queries up in the latest patch. I tested the actual query in pgsql, I just haven't been able to generate products and kits to make sure the logic is ok.

cha0s’s picture

er, the issue mapping seems to be broken, this was the issue: [#330451

EDIT: meh, this is it: http://drupal.org/node/330451

rszrama’s picture

Sweet, so I'll test this on the Livetest for MySQL but don't have a pgsql env't. If it works, at the very least we won't be taking any steps backwards. : P

Will look to hear more about an implemented test on pgsql.

rszrama’s picture

Status: Needs review » Fixed

Alrighty, like I mentioned... works for me on MySQL after a quick test. Given that a pgsql contributor made the replacement query and it seemed to at least execute properly for cha0s, I'm going to commit this and mark it fixed. We can always reopen if need be.

Status: Fixed » Closed (fixed)
Issue tags: -PostgreSQL

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