Refer to #1993166: Postgres: db_insert()->from($query) with zero rows causes error with default options.

This is a Postgres edge-case, but when the return value is not utilised, there's no reason not to make the change.

@see devel_rebuild_node_comment_statistics()

CommentFileSizeAuthor
#1 devel-db_insert_return_null-1993200-1.patch442 bytesjweowu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jweowu’s picture

Status: Active » Needs review
FileSize
442 bytes
salvis’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

Agreed.

salvis’s picture

salvis’s picture

Status: Needs review » Fixed

Pushed to D8 and D7 — thank you, jweowu!

Could this work for D6 with dbtng module, too?

jweowu’s picture

I've never used D6 + DBTNG myself, so while I would imagine this would be the case, I can't confirm it.

However I can see that InsertQuery::__construct() sets the same default return value using the same syntax in the D6 module's query.inc, and Database::RETURN_NULL is defined the same way in database.inc, so I'd be surprised if this wasn't applicable.

salvis’s picture

Makes sense, thanks.

Pushed to D6 as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.