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
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 390838.uc_product_kit_upgrade.2.x.patch | 1.24 KB | cha0s |
| #3 | 390838.uc_product_kit_upgrade(pgsql).2.x.patch | 906 bytes | cha0s |
Comments
Comment #1
agojc commentedThe 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.
Comment #2
rszrama commentedComment #3
cha0s commentedCan I get a witness?
Comment #4
cha0s commentedComment #5
rszrama commentedGetting some breakfast but wanted to ask real quick if you tested the proposed query in MySQL, too.
Comment #6
cha0s commentedI'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.
Comment #7
cha0s commenteder, the issue mapping seems to be broken, this was the issue: [#330451
EDIT: meh, this is it: http://drupal.org/node/330451
Comment #8
rszrama commentedSweet, 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.
Comment #9
rszrama commentedAlrighty, 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.