Commit f491c788 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2632 from deeky666/fix-postgresql-application-name-test

Fix "application_name" test on PostgreSQL < 9.2
parents 5e403613 c8b41af7
......@@ -73,12 +73,15 @@ class DriverTest extends AbstractDriverTest
$connection = $this->driver->connect($parameters, $user, $password);
$hash = microtime(true); // required to identify the record in the results uniquely
$sql = sprintf('SELECT query, application_name FROM pg_stat_activity WHERE %d = %d', $hash, $hash);
$sql = sprintf('SELECT * FROM pg_stat_activity WHERE %d = %d', $hash, $hash);
$statement = $connection->query($sql);
$records = $statement->fetchAll();
foreach ($records as $record) {
if ($record['query'] === $sql) {
// The query column is named "current_query" on PostgreSQL < 9.2
$queryColumnName = array_key_exists('current_query', $record) ? 'current_query' : 'query';
if ($record[$queryColumnName] === $sql) {
$this->assertSame('doctrine', $record['application_name']);
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment