From 3e4b7663ec551a2c47980f1170c862abf55edeab Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 26 Oct 2016 16:07:12 -0700 Subject: [PATCH] Add short-circuit to DatabasePostgres::schemaExists() Change-Id: I5221f7d937be1e87689df5a21fd64e244dbd4c2a --- includes/libs/rdbms/database/DatabasePostgres.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index 7acd8dce7b..b72557a65e 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -1175,8 +1175,12 @@ SQL; * @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; } -- 2.20.1