Closed smelesh closed 9 months ago
PostgreSQL
When queryCache is disabled, sub-query parameters are duplicated in the result statement:
queryCache
Scenario to reproduce the bug:
$db = new Database( name: 'default', prefix: '', driver: PostgresDriver::create(new PostgresDriverConfig( connection: new TcpConnectionConfig( database: 'test', ), queryCache: false, )), ); $subSelect = $db->select() ->from('posts AS p') ->where('p.feed', 'news'); $select = $db->select() ->from(['users as u']) ->innerJoin($subSelect, 'p')->on('p.user_id', 'u.id') ->where('u.status', 'active'); $this->assertSameQueryWithParameters( 'SELECT * FROM {users} AS {u} INNER JOIN ( SELECT * FROM {posts} AS {p} WHERE {p}.{feed} = ? ) AS {p} ON {p}.{user_id} = {u}.{id} WHERE {u}.{status} = ?', ['news', 'active'], $select );
Expected parameters: ['news', 'active'] Actual parameters: ['news', 'news', 'active']
database 2.4.1 PHP 8.1
Hi. Could you check MSSQL tests?
Thanks. Fixed, see details in PR thread.
No duplicates š„².
Database
PostgreSQL
What happened?
When
queryCache
is disabled, sub-query parameters are duplicated in the result statement:Scenario to reproduce the bug:
Expected parameters: ['news', 'active'] Actual parameters: ['news', 'news', 'active']
Version