diff options
Diffstat (limited to 'includes/database')
-rw-r--r-- | includes/database/pgsql/query.inc | 10 | ||||
-rw-r--r-- | includes/database/query.inc | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/includes/database/pgsql/query.inc b/includes/database/pgsql/query.inc index f3a4932ea..39a132bdd 100644 --- a/includes/database/pgsql/query.inc +++ b/includes/database/pgsql/query.inc @@ -14,11 +14,6 @@ class InsertQuery_pgsql extends InsertQuery { - public function __construct($connection, $table, array $options = array()) { - parent::__construct($connection, $table, $options); - $this->queryOptions['return'] = Database::RETURN_NULL; - } - public function execute() { // Confirm that the user did not try to specify an identical @@ -69,7 +64,10 @@ class InsertQuery_pgsql extends InsertQuery { if (!empty($table_information->sequences)) { $options['sequence_name'] = $table_information->sequences[0]; - $options['return'] = Database::RETURN_INSERT_ID; + } + // If there are no sequences then we can't get a last insert id. + elseif ($options['return'] == Database::RETURN_INSERT_ID) { + $options['return'] = Database::RETURN_NULL; } $last_insert_id = $this->connection->query($stmt, array(), $options); diff --git a/includes/database/query.inc b/includes/database/query.inc index 8cdaaf5e1..db0cd31ed 100644 --- a/includes/database/query.inc +++ b/includes/database/query.inc @@ -288,7 +288,9 @@ class InsertQuery extends Query { protected $insertValues = array(); public function __construct($connection, $table, array $options = array()) { - $options['return'] = Database::RETURN_INSERT_ID; + if (!isset($options['return'])) { + $options['return'] = Database::RETURN_INSERT_ID; + } $options += array('delay' => FALSE); parent::__construct($connection, $options); $this->table = $table; |