From bb82569cee12277e0f098b4829d0001d27f328f2 Mon Sep 17 00:00:00 2001
From: Dries Buytaert 
Date: Mon, 23 Feb 2004 17:45:03 +0000
Subject: [PATCH] - Patch 6012 by Adrian: syncs the PostgreSQL port with the
 current state of HEAD,   and adds a user notice to add the throttle and
 bootstrap columns to the   system table manually, else update.php will not
 run.  The message includes the   SQL statements required for both MySQL and
 PostgreSQL.
---
 database/database.pgsql | 10 ++++++++++
 update.php              | 38 ++++++++++++++++++++++++++++----------
 2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/database/database.pgsql b/database/database.pgsql
index 77646822fe77..12975aa294a9 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -166,6 +166,16 @@ CREATE TABLE feed (
   UNIQUE (url)
 );
 
+--
+-- Table structure for table 'filters'
+--
+
+CREATE TABLE filters (
+  module varchar(64) NOT NULL default '',
+  weight smallint DEFAULT '0' NOT NULL,
+  PRIMARY KEY (weight)
+);
+
 --
 -- Table structure for table 'forum'
 --
diff --git a/update.php b/update.php
index e8a51d3d15da..9e984c945ee1 100644
--- a/update.php
+++ b/update.php
@@ -634,7 +634,6 @@ function update_75() {
     update_sql("ALTER TABLE {feed} ALTER COLUMN modified SET NOT NULL");
 
     update_sql("ALTER TABLE {feed} RENAME timestamp TO checked");
-
     update_sql("UPDATE {blocks} SET module = 'aggregator' WHERE module = 'import'");
     update_sql("UPDATE {system} SET filename = 'modules/aggregator.module', name = 'aggregator' WHERE filename = 'modules/import.module'");
   }
@@ -668,18 +667,18 @@ function update_78() {
     )");
   }
   else {
-    /* Needs PGSQL/MSSQL equivalent */
+    update_sql("CREATE TABLE {filters} (
+      module varchar(64) NOT NULL default '',
+      weight smallint DEFAULT '0' NOT NULL,
+      PRIMARY KEY (weight)
+    )");
   }
 }
 
 function update_79() {
-  if ($GLOBALS["db_type"] == "pgsql") {
-    // Taking no action.  PostgreSQL is not always capable of dropping columns.
-  }
-  else {
-    update_sql("ALTER TABLE {node} DROP attributes");
-    update_sql("ALTER TABLE {comments} DROP link");
-  }
+  // Works for both mysql and postgresql
+  update_sql("ALTER TABLE {node} DROP attributes");
+  update_sql("ALTER TABLE {comments} DROP link");
 }
 
 /*
@@ -784,7 +783,26 @@ function update_info() {
   print "";
   print "Notes:";
   print "";
-  print " - If you upgrade from Drupal 4.2.0, you have to create the 
sessions table manually before upgrading.  After you created the table, you'll want to log in and immediately continue the upgrade.  To create the sessions table, issue the following SQL command (MySQL specific example):CREATE TABLE sessions (
+  print " 
 - If you upgrade from Drupal 4.3.x, you have will need to add the 
bootstrap and throttle fields to the system table manually before upgrading. To add the required fields, issue the following SQL commands:
+
+  MySQL specific example:
+  
+  ALTER TABLE system ADD throttle tinyint(1) NOT NULL DEFAULT '0';
+  ALTER TABLE system ADD bootstrap int(2);
+  
+   
+
+  PostgreSQL specific example:
+  
+  ALTER TABLE system ADD throttle smallint;
+  ALTER TABLE system ALTER COLUMN throttle SET DEFAULT '0';
+  UPDATE system SET throttle = 0;
+  ALTER TABLE system ALTER COLUMN throttle SET NOT NULL;
+  ALTER TABLE system ADD bootstrap integer;
+  
+  
+  ";
+  print " If you upgrade from Drupal 4.2.0, you have to create the sessions table manually before upgrading.  After you created the table, you'll want to log in and immediately continue the upgrade.  To create the sessions table, issue the following SQL command (MySQL specific example):CREATE TABLE sessions (
   uid int(10) unsigned NOT NULL,
   sid varchar(32) NOT NULL default '',
   hostname varchar(128) NOT NULL default '',