Commit c8b41af7 authored by Steve Müller's avatar Steve Müller

fix "application_name" test on PostgreSQL < 9.2

parent d8442038
......@@ -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