You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried to create a union query on two tables that are on different databases and get an error.
It does not seem to take into account the other DB prefix.
simplified Example:
CatsTable on DB cats.
DogsTable on DB dogs.
I did define the DB name in each Table with defaultConnectionName():
I can successfully query the tables individually.
We don't support joins/unions across databases. Database connections could be in different physical machines and there is no way for the ORM to safely abstract operations across databases.
Description
Tried to create a union query on two tables that are on different databases and get an error.
It does not seem to take into account the other DB prefix.
simplified Example:
CatsTable on DB cats.
DogsTable on DB dogs.
I did define the DB name in each Table with defaultConnectionName():
I can successfully query the tables individually.
Now I want to do a union query.
$catQuery = $this->fetchTable('Cats')->find()->order(['created'])->limit(10);
$dogQuery = $this->fetchTable('Dogs')->find()->order(['created'])->limit(10);
$query = $catQuery->unionAll($dogQuery)->order(['created'])->limit(10);
I get this error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'catsDb.dogsTable' doesn't exist.
CakePHP Version
4.4.18
PHP Version
8.1
The text was updated successfully, but these errors were encountered: