the following warning is printed when upgrading a Drupal 5.10 installation using a PostgreSQL 8.1 database to Drupal 6.4 with all contributed modules disabled before performing the update:
- warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "t" at character 25 in /var/www/drupal-6.4/includes/database.pgsql.inc on line 138.
- user warning: ERROR: syntax error at or near "t" at character 25 query: UPDATE drupal_term_node t SET vid = (SELECT vid FROM drupal_node n WHERE t.nid = n.nid) in /var/www/drupal-6.4/modules/system/system.install on line 1154.
The correct SQL syntax is:
UPDATE drupal_term_node set vid=(select vid from drupal_node n where drupal_term_node.nid=n.nid)
I manually used this statement to upgrade the database.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | postgres-system-upgrade-fix.patch | 576 bytes | stefanor |
| #2 | postgres-system-upgrade-fix.patch | 574 bytes | nigel |
| #1 | update.patch | 684 bytes | stefanor |
Comments
Comment #1
stefanor commentedAlso obtained, upgrading from 5.10 -> 6.4. The problem is that whereas in MySQL "AS" is optional, in PostgreSQL it isn't.
Patch attached.
Comment #2
nigel commentedHi. I also have this problem, but prepared a different patch. The first patch doesn't work in PostgreSQL 8.1, as per the following:
Attached is a patch that works for postgres 8.1. I can't test it in mysql or postgres 8.2/3 at this stage, would appreciate it if someone else could.
Comment #3
nigel commentedBumping this to critical (after discussion on #drupal-support). If the patch is not applied (and the query fails), then all data from term_node seems to be deleted :(
Comment #4
stefanor commentedNigel's patch was missing prefix support.
Comment #5
markstos commentedThis bug still exists in Drupal 6.9.
Comment #6
vacilando commentedSee potentially related problem at http://drupal.org/node/365664 (MySQL).
Comment #7
plj commentedJust tested stefanor's patch against a site to be upgraded from 5.15 to 6.10-dev (20090225); works like a champ.
Comment #8
gábor hojtsyCommitted to Drupal 6, thanks. Since Drupal 7 will remove Drupal 6 database updates by design, it is not applicable there.