From 21754d862d41a859e459e493f9b4de43b73d480f Mon Sep 17 00:00:00 2001 From: hawk__ Date: Sun, 20 May 2012 12:30:56 +0000 Subject: [PATCH] Added a hack so that wp_terms_seq is updated on installation git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@546556 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- pg4wp/driver_pgsql.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 75af584..2880f5c 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -328,6 +328,11 @@ // This will avoid modifications to anything following ' VALUES' list($sql,$end) = explode( ' VALUES', $sql, 2); $end = ' VALUES'.$end; + + // When installing, the sequence for table terms has to be updated + if( defined('WP_INSTALLING') && WP_INSTALLING && false !== strpos($sql, 'INSERT INTO `'.$wpdb->terms.'`')) + $end .= ';SELECT setval(\''.$wpdb->terms.'_seq\', (SELECT MAX(term_id) FROM '.$wpdb->terms.')+1);'; + } // INSERT elseif( 0 === strpos( $sql, 'DELETE' )) {