Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySqlDriver driver knows about subqueries now. #265

Merged
merged 1 commit into from
Oct 14, 2020
Merged

MySqlDriver driver knows about subqueries now. #265

merged 1 commit into from
Oct 14, 2020

Conversation

smuuf
Copy link
Contributor

@smuuf smuuf commented Oct 14, 2020

As MySQL/MariaDB clearly does support subqueries.

This enables proper building of queries like...

$table('table_a')
  ->where(
    'table_a.column_one IN',
    $table('table_b')->select('value')
  )

... without executing the inner query first.

See https://dev.mysql.com/doc/refman/8.0/en/subqueries.html
and https://mariadb.com/kb/en/subqueries/

  • bug fix / new feature? Both, I think.
  • BC break? Who knows.

As MySQL/MariaDB clearly does support subqueries.

This enables proper building of queries like...
```
$table('table_a')->where('table_a.column_one IN', $table('table_b')->select('value'))
```

... without executing the inner query first.

See https://dev.mysql.com/doc/refman/8.0/en/subqueries.html
and https://mariadb.com/kb/en/subqueries/
@dg
Copy link
Member

dg commented Oct 14, 2020

Thanks

@dg dg merged commit d00fb8a into nette:master Oct 14, 2020
dg pushed a commit that referenced this pull request Oct 15, 2020
dg pushed a commit that referenced this pull request Oct 15, 2020
@smuuf smuuf deleted the patch-1 branch October 17, 2020 18:29
dg pushed a commit that referenced this pull request Oct 25, 2020
dg pushed a commit that referenced this pull request Oct 28, 2020
dg pushed a commit that referenced this pull request Oct 28, 2020
dg pushed a commit that referenced this pull request Oct 29, 2020
dg pushed a commit that referenced this pull request Oct 29, 2020
dg pushed a commit that referenced this pull request Oct 30, 2020
dg pushed a commit that referenced this pull request Nov 6, 2020
dg pushed a commit that referenced this pull request Nov 25, 2020
dg pushed a commit that referenced this pull request Dec 21, 2020
@lulco
Copy link
Contributor

lulco commented Apr 21, 2021

Hi @smuuf and @dg

We just found problematic case here with subqueries:

$table('table_a')
  ->where(
    'table_a.column_one IN',
    $table('table_b')->select('value')->limit(100)
  )

Adding limit to subquery throws error:

This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' 

Mysql doc https://dev.mysql.com/doc/refman/8.0/en/subquery-restrictions.html reads:

MySQL does not support LIMIT in subqueries for certain subquery operators

@dg
Copy link
Member

dg commented Apr 22, 2021

I temporarily reverted it until we found a solution.

dg added a commit that referenced this pull request Apr 22, 2021
This reverts commit e89a34a.

"MySQL does not support LIMIT in subqueries for certain subquery operators" dev.mysql.com/doc/refman/8.0/en/subquery-restrictions.html
dg added a commit that referenced this pull request Apr 22, 2021
This reverts commit e89a34a.

"MySQL does not support LIMIT in subqueries for certain subquery operators" dev.mysql.com/doc/refman/8.0/en/subquery-restrictions.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants