diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc
index 9ed8a26..72eb1c4 100644
--- a/includes/database/pgsql/schema.inc
+++ b/includes/database/pgsql/schema.inc
@@ -124,11 +124,11 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
 
     $sql_keys = array();
     if (isset($table['primary key']) && is_array($table['primary key'])) {
-      $sql_keys[] = 'PRIMARY KEY (' . implode(', ', $table['primary key']) . ')';
+        $sql_keys[] = 'PRIMARY KEY (' . $this->createKeysSqlHelper($table['primary key']) . ')';
     }
     if (isset($table['unique keys']) && is_array($table['unique keys'])) {
       foreach ($table['unique keys'] as $key_name => $key) {
-        $sql_keys[] = 'CONSTRAINT ' . $this->prefixNonTable($name, $key_name, 'key') . ' UNIQUE (' . implode(', ', $key) . ')';
+        $sql_keys[] = 'CONSTRAINT ' . $this->prefixNonTable($name, $key_name, 'key') . ' UNIQUE (' . $this->createKeysSqlHelper($key) . ')';
       }
     }
 
@@ -163,6 +163,25 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
   }
 
   /**
+   * Create an SQL string for a field to be used in primary or unique key constraints.
+   *
+   * Any specification of length will be ignored since PostgreSQL supports out of the
+   * box indexing of text fields.
+   */
+  protected function createKeysSqlHelper($fields) {
+    $return = array();
+    foreach ($fields as $field) {
+      if (is_array($field)) {
+        $return[] = $field[0];
+      }
+      else {
+        $return[] = $field;
+      }
+    }
+    return implode(', ', $return);
+  }
+
+  /**
    * Create an SQL string for a field to be used in table creation or
    * alteration.
    *
@@ -441,7 +460,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
       throw new DatabaseSchemaObjectExistsException(t("Cannot add primary key to table %table: primary key already exists.", array('%table' => $table)));
     }
 
-    $this->connection->query('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . implode(',', $fields) . ')');
+    $this->connection->query('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . $this->createKeysSqlHelper($fields) . ')');
   }
 
   public function dropPrimaryKey($table) {
@@ -461,7 +480,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
       throw new DatabaseSchemaObjectExistsException(t("Cannot add unique key %name to table %table: unique key already exists.", array('%table' => $table, '%name' => $name)));
     }
 
-    $this->connection->query('ALTER TABLE {' . $table . '} ADD CONSTRAINT "' . $this->prefixNonTable($table, $name, 'key') . '" UNIQUE (' . implode(',', $fields) . ')');
+    $this->connection->query('ALTER TABLE {' . $table . '} ADD CONSTRAINT "' . $this->prefixNonTable($table, $name, 'key') . '" UNIQUE (' . $this->createKeysSqlHelper($fields) . ')');
   }
 
   public function dropUniqueKey($table, $name) {
