jenkins-bot has submitted this change and it was merged.

Change subject: Add short-circuit to DatabasePostgres::schemaExists()
......................................................................


Add short-circuit to DatabasePostgres::schemaExists()

Change-Id: I5221f7d937be1e87689df5a21fd64e244dbd4c2a
---
M includes/libs/rdbms/database/DatabasePostgres.php
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/rdbms/database/DatabasePostgres.php 
b/includes/libs/rdbms/database/DatabasePostgres.php
index 7acd8dc..b72557a 100644
--- a/includes/libs/rdbms/database/DatabasePostgres.php
+++ b/includes/libs/rdbms/database/DatabasePostgres.php
@@ -1175,8 +1175,12 @@
         * @return bool
         */
        function schemaExists( $schema ) {
-               $exists = $this->selectField( '"pg_catalog"."pg_namespace"', 1,
-                       [ 'nspname' => $schema ], __METHOD__ );
+               if ( !strlen( $schema ) ) {
+                       return false; // short-circuit
+               }
+
+               $exists = $this->selectField(
+                       '"pg_catalog"."pg_namespace"', 1, [ 'nspname' => 
$schema ], __METHOD__ );
 
                return (bool)$exists;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/318220
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5221f7d937be1e87689df5a21fd64e244dbd4c2a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to