Merge pull request #8934 from creative-commoners/pulls/4.4/pdostgresql-boolean-consistency

FIX Postgres booleans should return as int for consistency
This commit is contained in:
Sam Minnée 2019-04-17 15:43:35 +12:00 committed by GitHub
commit 155a9bb1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class PDOStatementHandle
'float8' => 'float',
'float16' => 'float',
'numeric' => 'float',
'bool' => 'int', // Bools should be ints
// MySQL
'NEWDECIMAL' => 'float',

View File

@ -267,5 +267,9 @@ class DatabaseTest extends SapphireTest
// Dates are returned as strings
$this->assertInternalType('string', $record['Created'], 'DBDatetime fields should be string (non-prepared)');
// Booleans selected directly are ints
$result = DB::query('SELECT TRUE')->first();
$this->assertInternalType('int', reset($result));
}
}