From: Aaron Schulz Date: Wed, 26 Oct 2016 23:07:12 +0000 (-0700) Subject: Add short-circuit to DatabasePostgres::schemaExists() X-Git-Tag: 1.31.0-rc.0~5021^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=3e4b7663ec551a2c47980f1170c862abf55edeab;p=lhc%2Fweb%2Fwiklou.git Add short-circuit to DatabasePostgres::schemaExists() Change-Id: I5221f7d937be1e87689df5a21fd64e244dbd4c2a --- 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; }