Skip to content

implement values row syntax , first part (joins)#148

Merged
jongleb merged 2 commits intoygrek:ahrefsfrom
jongleb:row-values-first-part-joins
Feb 3, 2025
Merged

implement values row syntax , first part (joins)#148
jongleb merged 2 commits intoygrek:ahrefsfrom
jongleb:row-values-first-part-joins

Conversation

@jongleb
Copy link
Copy Markdown
Collaborator

@jongleb jongleb commented Jan 20, 2025

Description

This PR adds a support of VALUES ROW(..) syntax.

https://dev.mysql.com/doc/refman/8.4/en/values.html

At the current step, it's supported for JOINS, but it's already now considered as a new source, so it wouldn't be a problem to support the rest of the usages of this syntax.

Also it supports two variants of it:

SELECT p.id, x.a
FROM products p
JOIN ( VALUES ROW(...) ) AS x (a, b)
ON p.name = x.b;

And

SELECT p.id, x.a
FROM products p
JOIN ( VALUES @param ) AS x (a, b)
ON p.name = x.b;

And since VALUES with no ROWs afters is invalid syntax, I added a default expression when the passed list is empty:

SELECT %cols% WHERE FALSE

This part is up for debate, but it seems safer

@jongleb jongleb force-pushed the row-values-first-part-joins branch from 62c2aa4 to e0e287e Compare January 20, 2025 17:51
@jongleb jongleb self-assigned this Jan 20, 2025
@jongleb jongleb requested a review from ygrek January 20, 2025 18:03
@jongleb jongleb marked this pull request as ready for review January 20, 2025 18:03
@jongleb
Copy link
Copy Markdown
Collaborator Author

jongleb commented Jan 23, 2025

@ygrek Could you take a look , please

@jongleb
Copy link
Copy Markdown
Collaborator Author

jongleb commented Feb 3, 2025

@ygrek I am merging it, If you have any comments, please write and I will fix them in the next PR.

@jongleb jongleb merged commit 99818ef into ygrek:ahrefs Feb 3, 2025
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.

1 participant