ygrek / sqlgg

SQL Guided (code) Generator
https://ygrek.org/p/sqlgg/
GNU General Public License v2.0
61 stars 20 forks source link

Add JOIN statement tests #123

Closed jongleb closed 2 months ago

jongleb commented 11 months ago

These test shows required improvements to make JOINS work properly.

When dealing with a LEFT JOIN, nullability arises under the following scenarios:

  1. No Foreign Key:

    • If there is no foreign key relationship between the tables involved in the LEFT JOIN, nullability can occur when there is no matching record in the right table. In this case, all fields from the right table will be NULL.
  2. Nullable Foreign Key:

    • Nullability may also arise when there is a nullable foreign key, and there is no matching record in the right table. If the foreign key in the left table allows NULL values, fields from the right table will be NULL in case of no match.

These scenarios highlight the conditions under which NULL values may appear in the result set of a LEFT JOIN operation.

ygrek commented 11 months ago

overall FOREIGN KEY was not handled until now at all, so thanks for bringing this up, but please uncomment the test cases so that they are actually failing

jongleb commented 11 months ago

lease uncomment the test cases so that they are actually failing

Done.

for the second case it mentions ON DELETE CASCADE in description, but not in the

I removed this option, thanks, I found out that nullability on JOIN depends only on the column nullability and on the reference existence