Full expected (Postgres) vs actual (Legend) result sets for every test where results differ.
Total result mismatches: 91
SQL (Postgres):
SELECT DIV(numeric_val, 3.0) AS result FROM numbers WHERE numeric_val IS NOT NULL AND numeric_val <> 0 ORDER BY 1
SQL (Legend, rewritten):
SELECT DIV(numeric_val, 3.0) AS result FROM func('e2e::tds_numbers') WHERE numeric_val IS NOT NULL AND numeric_val <> 0 ORDER BY 1
SQL (Generated, executed against DB):
select ((1.0 * "root".numeric_val) / 3.0) as "result" from public.numbers as "root" where ("root".numeric_val is not null and "root".numeric_val is distinct from 0) order by "result"
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.intVal,
'int_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.floatVal,
'float_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.numericVal,
'numeric_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.smallVal,
'small_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.bigVal,
'big_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getFloat('numeric_val')->meta::pure::functions::collection::isNotEmpty() &&
$row.getFloat('numeric_val') != 0
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getFloat('numeric_val') / 3.0,
'result'
)
)->meta::pure::tds::sort(
meta::pure::tds::asc('result')
)
Differences:
Expected (Postgres):
| result |
|---|
| -33333 |
| 0 |
| 0 |
| 0 |
| 111 |
| 4115 |
| 16666 |
| 33333333333333 |
Actual (Legend):
| result |
|---|
| -33333.33333 |
| -0.3333333333333333 |
| -3.3333333333333333E-6 |
| 3.3333333333333333E-6 |
| 111.11111 |
| 4115.2263 |
| 16666.70781666667 |
| 3.3333333333333332E13 |
SQL (Postgres):
SELECT DIV(numeric_val, 3.0) AS result FROM numbers WHERE numeric_val IS NOT NULL AND numeric_val <> 0 ORDER BY 1
SQL (Legend, rewritten):
SELECT DIV(numeric_val, 3.0) AS result FROM func('e2e::rel_numbers') WHERE numeric_val IS NOT NULL AND numeric_val <> 0 ORDER BY 1
SQL (Generated, executed against DB):
select ((1.0 * "root".numeric_val) / 3.0) as "result" from public.numbers as "root" where ("root".numeric_val is not null and "root".numeric_val is distinct from 0) order by "result"
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.numeric_val->meta::pure::functions::collection::isNotEmpty() &&
$x.numeric_val != 0
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.numeric_val->meta::pure::functions::multiplicity::toOne() / 3.0
]
)->meta::pure::functions::relation::sort(
~result->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| result |
|---|
| -33333 |
| 0 |
| 0 |
| 0 |
| 111 |
| 4115 |
| 16666 |
| 33333333333333 |
Actual (Legend):
| result |
|---|
| -33333.33333 |
| -0.3333333333333333 |
| -3.3333333333333333E-6 |
| 3.3333333333333333E-6 |
| 111.11111 |
| 4115.2263 |
| 16666.70781666667 |
| 3.3333333333333332E13 |
SQL (Postgres):
SELECT CONCAT_WS(', ', val, nullable_val) AS result FROM strings ORDER BY 1
SQL (Legend, rewritten):
SELECT CONCAT_WS(', ', val, nullable_val) AS result FROM func('e2e::tds_strings') ORDER BY 1
SQL (Generated, executed against DB):
select "root".val || "root".nullable_val || Text', ' as "result" from public.strings as "root" order by "result"
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[
$row.getString('val'),
$row.getString('nullable_val')
]->meta::pure::functions::string::joinStrings(', '),
'result'
)
)->meta::pure::tds::sort(
meta::pure::tds::asc('result')
)
Differences:
Expected (Postgres):
| result |
|---|
| spaces , has spaces |
| MiXeD CaSe |
| UPPERCASE, lowercase |
| WORLD, test |
| abcdefghij, ABCDEFGHIJ |
| hello, world |
| repeat, repeat |
| special!@#$%, 12345 |
| the quick brown fox, jumps over |
Actual (Legend):
| result |
|---|
| spaces has spaces, |
| UPPERCASElowercase, |
| WORLDtest, |
| abcdefghijABCDEFGHIJ, |
| helloworld, |
| repeatrepeat, |
| special!@#$%12345, |
| the quick brown foxjumps over, |
| NULL |
| NULL |
SQL (Postgres):
SELECT CONCAT_WS(', ', val, nullable_val) AS result FROM strings ORDER BY 1
SQL (Legend, rewritten):
SELECT CONCAT_WS(', ', val, nullable_val) AS result FROM func('e2e::rel_strings') ORDER BY 1
SQL (Generated, executed against DB):
select concat("root".val,Text', ',"root".nullable_val) as "result" from public.strings as "root" order by "result"
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|[
$x.val->meta::pure::functions::multiplicity::toOne(),
$x.nullable_val->meta::pure::functions::multiplicity::toOne()
]->meta::pure::functions::string::joinStrings(', ')
]
)->meta::pure::functions::relation::sort(
~result->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| result |
|---|
| spaces , has spaces |
| MiXeD CaSe |
| UPPERCASE, lowercase |
| WORLD, test |
| abcdefghij, ABCDEFGHIJ |
| hello, world |
| repeat, repeat |
| special!@#$%, 12345 |
| the quick brown fox, jumps over |
Actual (Legend):
| result |
|---|
| spaces , has spaces |
| , |
| MiXeD CaSe, |
| UPPERCASE, lowercase |
| WORLD, test |
| abcdefghij, ABCDEFGHIJ |
| hello, world |
| repeat, repeat |
| special!@#$%, 12345 |
| the quick brown fox, jumps over |
SQL (Postgres):
SELECT INITCAP(val) AS result FROM strings ORDER BY 1
SQL (Legend, rewritten):
SELECT INITCAP(val) AS result FROM func('e2e::tds_strings') ORDER BY 1
SQL (Generated, executed against DB):
select case when char_length("root".val) = 0 then "root".val else concat(upper(left("root".val,1)),'',substring("root".val, 2)) end as "result" from public.strings as "root" order by "result"
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::string::toUpperFirstCharacter(),
'result'
)
)->meta::pure::tds::sort(
meta::pure::tds::asc('result')
)
Differences:
Expected (Postgres):
| result |
|---|
| Spaces |
| Abcdefghij |
| Hello |
| Mixed Case |
| Repeat |
| Special!@#$% |
| The Quick Brown Fox |
| Uppercase |
| World |
Actual (Legend):
| result |
|---|
| spaces |
| Abcdefghij |
| Hello |
| MiXeD CaSe |
| Repeat |
| Special!@#$% |
| The quick brown fox |
| UPPERCASE |
| WORLD |
SQL (Postgres):
SELECT INITCAP(val) AS result FROM strings ORDER BY 1
SQL (Legend, rewritten):
SELECT INITCAP(val) AS result FROM func('e2e::rel_strings') ORDER BY 1
SQL (Generated, executed against DB):
select case when char_length("root".val) = 0 then "root".val else concat(upper(left("root".val,1)), substring("root".val, 2)) end as "result" from public.strings as "root" order by "result"
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::toUpperFirstCharacter()
]
)->meta::pure::functions::relation::sort(
~result->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| result |
|---|
| Spaces |
| Abcdefghij |
| Hello |
| Mixed Case |
| Repeat |
| Special!@#$% |
| The Quick Brown Fox |
| Uppercase |
| World |
Actual (Legend):
| result |
|---|
| spaces |
| Abcdefghij |
| Hello |
| MiXeD CaSe |
| Repeat |
| Special!@#$% |
| The quick brown fox |
| UPPERCASE |
| WORLD |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 2) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 2) AS result FROM func('e2e::tds_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 10
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne(),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| quick |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 2) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 2) AS result FROM func('e2e::rel_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.id == 10
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne()
]
)
Differences:
Expected (Postgres):
| result |
|---|
| quick |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 4) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 4) AS result FROM func('e2e::tds_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 10
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne(),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| fox |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 4) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 1, 4) AS result FROM func('e2e::rel_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.id == 10
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne()
]
)
Differences:
Expected (Postgres):
| result |
|---|
| fox |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5) AS result FROM func('e2e::tds_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 10
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne(),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| quick |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5) AS result FROM func('e2e::rel_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.id == 10
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne()
]
)
Differences:
Expected (Postgres):
| result |
|---|
| quick |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5, 2) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5, 2) AS result FROM func('e2e::tds_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 10
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne(),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| brown |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5, 2) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_SUBSTR(val, '[a-z]+', 5, 2) AS result FROM func('e2e::rel_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_substr("root".val, Text'[a-z]+', 1, 1, 'p', 0) as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.id == 10
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::regexpExtract(
'[a-z]+',
false
)->meta::pure::functions::multiplicity::toOne()
]
)
Differences:
Expected (Postgres):
| result |
|---|
| brown |
Actual (Legend):
| result |
|---|
| the |
SQL (Postgres):
SELECT REGEXP_COUNT(val, '[a-z]', 5) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_COUNT(val, '[a-z]', 5) AS result FROM func('e2e::tds_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_count("root".val, Text'[a-z]', 1, 'p') as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 10
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::string::regexpCount('[a-z]'),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| 13 |
Actual (Legend):
| result |
|---|
| 16 |
SQL (Postgres):
SELECT REGEXP_COUNT(val, '[a-z]', 5) AS result FROM strings WHERE id = 10
SQL (Legend, rewritten):
SELECT REGEXP_COUNT(val, '[a-z]', 5) AS result FROM func('e2e::rel_strings') WHERE id = 10
SQL (Generated, executed against DB):
select regexp_count("root".val, Text'[a-z]', 1, 'p') as "result" from public.strings as "root" where "root".id = 10
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.id == 10
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::regexpCount('[a-z]')
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 13 |
Actual (Legend):
| result |
|---|
| 16 |
SQL (Postgres):
SELECT STRING_TO_ARRAY(val, ' ') AS result FROM strings WHERE val IS NOT NULL ORDER BY 1
SQL (Legend, rewritten):
SELECT STRING_TO_ARRAY(val, ' ') AS result FROM func('e2e::tds_strings') WHERE val IS NOT NULL ORDER BY 1
SQL (Generated, executed against DB):
select string_to_array("root".val, Text' ') as "result" from public.strings as "root" where "root".val is not null order by "result"
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::collection::isNotEmpty()
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val')->meta::pure::functions::string::split(' '),
'result'
)
)->meta::pure::tds::sort(
meta::pure::tds::asc('result')
)
Differences:
Expected (Postgres):
| result |
|---|
| {} |
| {"","",spaces,"",""} |
| {MiXeD,CaSe} |
| {UPPERCASE} |
| {WORLD} |
| {abcdefghij} |
| {hello} |
| {repeat} |
| {special!@#$%} |
| {the,quick,brown,fox} |
Actual (Legend):
| result |
|---|
| [] |
| ["","","spaces","",""] |
| ["MiXeD","CaSe"] |
| ["UPPERCASE"] |
| ["WORLD"] |
| ["abcdefghij"] |
| ["hello"] |
| ["repeat"] |
| ["special!@#$%"] |
| ["the","quick","brown","fox"] |
SQL (Postgres):
SELECT STRING_TO_ARRAY(val, ' ') AS result FROM strings WHERE val IS NOT NULL ORDER BY 1
SQL (Legend, rewritten):
SELECT STRING_TO_ARRAY(val, ' ') AS result FROM func('e2e::rel_strings') WHERE val IS NOT NULL ORDER BY 1
SQL (Generated, executed against DB):
select string_to_array("root".val, Text' ') as "result" from public.strings as "root" where "root".val is not null order by "result"
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::StringRow[1]|$x.id,
val: x: e2e::StringRow[1]|$x.val,
nullable_val: x: e2e::StringRow[1]|$x.nullableVal,
unicode_val: x: e2e::StringRow[1]|$x.unicodeVal,
empty_val: x: e2e::StringRow[1]|$x.emptyVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::collection::isNotEmpty()
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], val:String, nullable_val:String, unicode_val:String, empty_val:String)[1]|$x.val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::split(' ')
]
)->meta::pure::functions::relation::sort(
~result->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| result |
|---|
| {} |
| {"","",spaces,"",""} |
| {MiXeD,CaSe} |
| {UPPERCASE} |
| {WORLD} |
| {abcdefghij} |
| {hello} |
| {repeat} |
| {special!@#$%} |
| {the,quick,brown,fox} |
Actual (Legend):
| result |
|---|
| [] |
| ["","","spaces","",""] |
| ["MiXeD","CaSe"] |
| ["UPPERCASE"] |
| ["WORLD"] |
| ["abcdefghij"] |
| ["hello"] |
| ["repeat"] |
| ["special!@#$%"] |
| ["the","quick","brown","fox"] |
SQL (Postgres):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456' AS result FROM dates LIMIT 1
SQL (Legend, rewritten):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456' AS result FROM func('e2e::tds_dates') LIMIT 1
SQL (Generated, executed against DB):
select Timestamp'1999-01-08 04:05:06.123456' as "result" from public.dates as "root" limit 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.d,
'd'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.ts,
'ts'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.tsz,
'tsz'
)
]
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|%1999-01-08T04:05:06.123456+0000,
'result'
)
)->meta::pure::tds::limit(1)
Differences:
Expected (Postgres):
| result |
|---|
| 1999-01-08 04:05:06.123456 |
Actual (Legend):
| result |
|---|
| 1999-01-08 04:05:06.123 |
SQL (Postgres):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456' AS result FROM dates LIMIT 1
SQL (Legend, rewritten):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456' AS result FROM func('e2e::rel_dates') LIMIT 1
SQL (Generated, executed against DB):
select Timestamp'1999-01-08 04:05:06.123456' as "result" from public.dates as "root" limit 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::DateRow[1]|$x.id,
d: x: e2e::DateRow[1]|$x.d,
ts: x: e2e::DateRow[1]|$x.ts,
tsz: x: e2e::DateRow[1]|$x.tsz
]
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|%1999-01-08T04:05:06.123456+0000
]
)->meta::pure::functions::relation::limit(1)
Differences:
Expected (Postgres):
| result |
|---|
| 1999-01-08 04:05:06.123456 |
Actual (Legend):
| result |
|---|
| 1999-01-08 04:05:06.123 |
SQL (Postgres):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456789' AS result FROM dates LIMIT 1
SQL (Legend, rewritten):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456789' AS result FROM func('e2e::tds_dates') LIMIT 1
SQL (Generated, executed against DB):
select Timestamp'1999-01-08 04:05:06.123456789' as "result" from public.dates as "root" limit 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.d,
'd'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.ts,
'ts'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.tsz,
'tsz'
)
]
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|%1999-01-08T04:05:06.123456789+0000,
'result'
)
)->meta::pure::tds::limit(1)
Differences:
Expected (Postgres):
| result |
|---|
| 1999-01-08 04:05:06.123457 |
Actual (Legend):
| result |
|---|
| 1999-01-08 04:05:06.123 |
SQL (Postgres):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456789' AS result FROM dates LIMIT 1
SQL (Legend, rewritten):
SELECT TIMESTAMP '1999-01-08 04:05:06.123456789' AS result FROM func('e2e::rel_dates') LIMIT 1
SQL (Generated, executed against DB):
select Timestamp'1999-01-08 04:05:06.123456789' as "result" from public.dates as "root" limit 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::DateRow[1]|$x.id,
d: x: e2e::DateRow[1]|$x.d,
ts: x: e2e::DateRow[1]|$x.ts,
tsz: x: e2e::DateRow[1]|$x.tsz
]
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|%1999-01-08T04:05:06.123456789+0000
]
)->meta::pure::functions::relation::limit(1)
Differences:
Expected (Postgres):
| result |
|---|
| 1999-01-08 04:05:06.123457 |
Actual (Legend):
| result |
|---|
| 1999-01-08 04:05:06.123 |
SQL (Postgres):
SELECT JSON_EXTRACT_PATH(json_val, 'a', 'b', 'c') AS result FROM json_data WHERE id = 2
SQL (Legend, rewritten):
SELECT JSON_EXTRACT_PATH(json_val, 'a', 'b', 'c') AS result FROM func('e2e::rel_json_data') WHERE id = 2
SQL (Generated, executed against DB):
select jsonb_extract_path(cast(jsonb_extract_path(cast(jsonb_extract_path(cast("json_data_0".json_val as jsonb), Text'a') as jsonb), Text'b') as jsonb), Text'c') as "result" from public.json_data as "json_data_0" where "json_data_0".id = 2
Lambda (Pure expression):
|#>{e2e::TestDB.public.json_data}#->meta::pure::functions::relation::filter(
x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.id == 2
)->meta::pure::functions::relation::project(
~[
result: x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.json_val->meta::pure::functions::variant::navigation::get('a')->meta::pure::functions::variant::navigation::get('b')->meta::pure::functions::variant::navigation::get('c')
]
)
Differences:
Expected (Postgres):
| result |
|---|
| "nested" |
Actual (Legend):
| result |
|---|
| ""nested"" |
SQL (Postgres):
SELECT ARRAY_POSITION(ARRAY[1,2,3], 2) AS result FROM numbers WHERE id = 1
SQL (Legend, rewritten):
SELECT ARRAY_POSITION(ARRAY[1, 2, 3], 2) AS result FROM func('e2e::rel_numbers') WHERE id = 1
SQL (Generated, executed against DB):
select (coalesce((select min(t.o) from jsonb_array_elements(cast(cast(jsonb_build_array(1,2,3) as JSONB) as jsonb)) with ordinality t(v, o) where t.v = to_jsonb(2)), 0) - 1) as "result" from public.numbers as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|[
1,
2,
3
]->meta::pure::functions::collection::indexOf(2)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 2 |
Actual (Legend):
| result |
|---|
| 1 |
SQL (Postgres):
SELECT id, int_val / 5 AS result FROM numbers WHERE id = 9
SQL (Legend, rewritten):
SELECT id, int_val / 5 AS result FROM func('e2e::tds_numbers') WHERE id = 9
SQL (Generated, executed against DB):
select "root".id as "id", ((1.0 * "root".int_val) / 5) as "result" from public.numbers as "root" where "root".id = 9
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.intVal,
'int_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.floatVal,
'float_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.numericVal,
'numeric_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.smallVal,
'small_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.bigVal,
'big_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 9
)->meta::pure::tds::project(
[
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id'),
'id'
),
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('int_val') / 5,
'result'
)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 9 | 1 |
Actual (Legend):
| id | result |
|---|---|
| 9 | 1.4 |
SQL (Postgres):
SELECT id, int_val / 5 AS result FROM numbers WHERE id = 9
SQL (Legend, rewritten):
SELECT id, int_val / 5 AS result FROM func('e2e::rel_numbers') WHERE id = 9
SQL (Generated, executed against DB):
select "root".id as "id", ((1.0 * "root".int_val) / 5) as "result" from public.numbers as "root" where "root".id = 9
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 9
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.int_val->meta::pure::functions::multiplicity::toOne() / 5
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 9 | 1 |
Actual (Legend):
| id | result |
|---|---|
| 9 | 1.4 |
SQL (Postgres):
SELECT id, int_val / 3 AS result FROM numbers WHERE id = 2
SQL (Legend, rewritten):
SELECT id, int_val / 3 AS result FROM func('e2e::tds_numbers') WHERE id = 2
SQL (Generated, executed against DB):
select "root".id as "id", ((1.0 * "root".int_val) / 3) as "result" from public.numbers as "root" where "root".id = 2
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.intVal,
'int_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.floatVal,
'float_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.numericVal,
'numeric_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.smallVal,
'small_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.bigVal,
'big_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 2
)->meta::pure::tds::project(
[
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id'),
'id'
),
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('int_val') / 3,
'result'
)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 2 | -3 |
Actual (Legend):
| id | result |
|---|---|
| 2 | -3.3333333333333335 |
SQL (Postgres):
SELECT id, int_val / 3 AS result FROM numbers WHERE id = 2
SQL (Legend, rewritten):
SELECT id, int_val / 3 AS result FROM func('e2e::rel_numbers') WHERE id = 2
SQL (Generated, executed against DB):
select "root".id as "id", ((1.0 * "root".int_val) / 3) as "result" from public.numbers as "root" where "root".id = 2
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 2
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.int_val->meta::pure::functions::multiplicity::toOne() / 3
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 2 | -3 |
Actual (Legend):
| id | result |
|---|---|
| 2 | -3.3333333333333335 |
SQL (Postgres):
SELECT id, int_val % 3 AS result FROM numbers WHERE id = 2
SQL (Legend, rewritten):
SELECT id, int_val % 3 AS result FROM func('e2e::tds_numbers') WHERE id = 2
SQL (Generated, executed against DB):
select "root".id as "id", mod(mod("root".int_val, 3) + 3, 3) as "result" from public.numbers as "root" where "root".id = 2
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.intVal,
'int_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.floatVal,
'float_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.numericVal,
'numeric_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.smallVal,
'small_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.bigVal,
'big_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 2
)->meta::pure::tds::project(
[
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id'),
'id'
),
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('int_val')->meta::pure::functions::math::mod(3),
'result'
)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 2 | -1 |
Actual (Legend):
| id | result |
|---|---|
| 2 | 2 |
SQL (Postgres):
SELECT id, int_val % 3 AS result FROM numbers WHERE id = 2
SQL (Legend, rewritten):
SELECT id, int_val % 3 AS result FROM func('e2e::rel_numbers') WHERE id = 2
SQL (Generated, executed against DB):
select "root".id as "id", mod(mod("root".int_val, 3) + 3, 3) as "result" from public.numbers as "root" where "root".id = 2
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 2
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.int_val->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::math::mod(3)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 2 | -1 |
Actual (Legend):
| id | result |
|---|---|
| 2 | 2 |
SQL (Postgres):
SELECT id, numeric_val % 3 AS result FROM numbers WHERE id = 1
SQL (Legend, rewritten):
SELECT id, numeric_val % 3 AS result FROM func('e2e::tds_numbers') WHERE id = 1
SQL (Generated, executed against DB):
select "root".id as "id", mod(mod("root".numeric_val, 3) + 3, 3) as "result" from public.numbers as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.intVal,
'int_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.floatVal,
'float_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.numericVal,
'numeric_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.smallVal,
'small_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.bigVal,
'big_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
[
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id'),
'id'
),
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getFloat('numeric_val')->meta::pure::functions::math::mod(3),
'result'
)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 1 | 0.67890 |
Actual (Legend):
| id | result |
|---|---|
| 1 | 0 |
SQL (Postgres):
SELECT d + 5 AS result FROM dates WHERE id = 1
SQL (Legend, rewritten):
SELECT d + 5 AS result FROM func('e2e::tds_dates') WHERE id = 1
SQL (Generated, executed against DB):
select ("root".d + (INTERVAL '1 DAYS' * 5)) as "result" from public.dates as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.d,
'd'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.ts,
'ts'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.tsz,
'tsz'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getStrictDate('d')->meta::pure::functions::date::adjust(
5,
meta::pure::functions::date::DurationUnit.DAYS
),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| 2023-01-20 |
Actual (Legend):
| result |
|---|
| 2023-01-20 00:00:00.0 |
SQL (Postgres):
SELECT d + 5 AS result FROM dates WHERE id = 1
SQL (Legend, rewritten):
SELECT d + 5 AS result FROM func('e2e::rel_dates') WHERE id = 1
SQL (Generated, executed against DB):
select ("root".d + (INTERVAL '1 DAYS' * 5)) as "result" from public.dates as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::DateRow[1]|$x.id,
d: x: e2e::DateRow[1]|$x.d,
ts: x: e2e::DateRow[1]|$x.ts,
tsz: x: e2e::DateRow[1]|$x.tsz
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|$x.d->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::date::adjust(
5,
meta::pure::functions::date::DurationUnit.DAYS
)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 2023-01-20 |
Actual (Legend):
| result |
|---|
| 2023-01-20 00:00:00.0 |
SQL (Postgres):
SELECT d - 5 AS result FROM dates WHERE id = 1
SQL (Legend, rewritten):
SELECT d - 5 AS result FROM func('e2e::tds_dates') WHERE id = 1
SQL (Generated, executed against DB):
select ("root".d + (INTERVAL '1 DAYS' * 5)) as "result" from public.dates as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.d,
'd'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.ts,
'ts'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.tsz,
'tsz'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getStrictDate('d')->meta::pure::functions::date::adjust(
5,
meta::pure::functions::date::DurationUnit.DAYS
),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| 2023-01-10 |
Actual (Legend):
| result |
|---|
| 2023-01-20 00:00:00.0 |
SQL (Postgres):
SELECT d - 5 AS result FROM dates WHERE id = 1
SQL (Legend, rewritten):
SELECT d - 5 AS result FROM func('e2e::rel_dates') WHERE id = 1
SQL (Generated, executed against DB):
select ("root".d + (INTERVAL '1 DAYS' * 5)) as "result" from public.dates as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::DateRow[1]|$x.id,
d: x: e2e::DateRow[1]|$x.d,
ts: x: e2e::DateRow[1]|$x.ts,
tsz: x: e2e::DateRow[1]|$x.tsz
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|$x.d->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::date::adjust(
5,
meta::pure::functions::date::DurationUnit.DAYS
)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 2023-01-10 |
Actual (Legend):
| result |
|---|
| 2023-01-20 00:00:00.0 |
SQL (Postgres):
SELECT val || '-' || nullable_val AS result FROM strings ORDER BY 1
SQL (Legend, rewritten):
SELECT val || '-' || nullable_val AS result FROM func('e2e::tds_strings') ORDER BY 1
SQL (Generated, executed against DB):
select concat("root".val,'',Text'-','',"root".nullable_val) as "result" from public.strings as "root" order by "result"
Lambda (Pure expression):
|e2e::StringRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.val,
'val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.nullableVal,
'nullable_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.unicodeVal,
'unicode_val'
),
meta::pure::tds::col(
x: e2e::StringRow[1]|$x.emptyVal,
'empty_val'
)
]
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('val') + '-' + $row.getString('nullable_val'),
'result'
)
)->meta::pure::tds::sort(
meta::pure::tds::asc('result')
)
Differences:
Expected (Postgres):
| result |
|---|
| spaces -has spaces |
| UPPERCASE-lowercase |
| WORLD-test |
| abcdefghij-ABCDEFGHIJ |
| hello-world |
| repeat-repeat |
| special!@#$%-12345 |
| the quick brown fox-jumps over |
| NULL |
| NULL |
Actual (Legend):
| result |
|---|
| spaces -has spaces |
| - |
| MiXeD CaSe- |
| UPPERCASE-lowercase |
| WORLD-test |
| abcdefghij-ABCDEFGHIJ |
| hello-world |
| repeat-repeat |
| special!@#$%-12345 |
| the quick brown fox-jumps over |
SQL (Postgres):
SELECT 'val=' || NULL || '-' || 42 AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT 'val=' || NULL || '-' || 42 AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Text'val=-42' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|'val=' + [] + '-' + meta::pure::functions::string::toString(42),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| NULL |
Actual (Legend):
| result |
|---|
| val=-42 |
SQL (Postgres):
SELECT NULL = NULL AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT NULL = NULL AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Boolean'true' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[] ==
[],
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| NULL |
Actual (Legend):
| result |
|---|
| true |
SQL (Postgres):
SELECT id, int_val <> 42 AS result FROM numbers WHERE id = 5
SQL (Legend, rewritten):
SELECT id, int_val <> 42 AS result FROM func('e2e::tds_numbers') WHERE id = 5
SQL (Generated, executed against DB):
select "root".id as "id", "root".int_val is distinct from 42 as "result" from public.numbers as "root" where "root".id = 5
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.intVal,
'int_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.floatVal,
'float_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.numericVal,
'numeric_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.smallVal,
'small_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.bigVal,
'big_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 5
)->meta::pure::tds::project(
[
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id'),
'id'
),
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('int_val') != 42,
'result'
)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 5 | NULL |
Actual (Legend):
| id | result |
|---|---|
| 5 | true |
SQL (Postgres):
SELECT id, int_val <> 42 AS result FROM numbers WHERE id = 5
SQL (Legend, rewritten):
SELECT id, int_val <> 42 AS result FROM func('e2e::rel_numbers') WHERE id = 5
SQL (Generated, executed against DB):
select "root".id as "id", "root".int_val is distinct from 42 as "result" from public.numbers as "root" where "root".id = 5
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 5
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.int_val != 42
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 5 | NULL |
Actual (Legend):
| id | result |
|---|---|
| 5 | true |
SQL (Postgres):
SELECT id, int_val < 100 AS result FROM numbers WHERE id = 5
SQL (Legend, rewritten):
SELECT id, int_val < 100 AS result FROM func('e2e::rel_numbers') WHERE id = 5
SQL (Generated, executed against DB):
select "root".id as "id", ("root".int_val is not null and "root".int_val < 100) as "result" from public.numbers as "root" where "root".id = 5
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 5
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.int_val < 100
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 5 | NULL |
Actual (Legend):
| id | result |
|---|---|
| 5 | false |
SQL (Postgres):
SELECT id, int_val > 10 AS result FROM numbers WHERE id = 5
SQL (Legend, rewritten):
SELECT id, int_val > 10 AS result FROM func('e2e::rel_numbers') WHERE id = 5
SQL (Generated, executed against DB):
select "root".id as "id", ("root".int_val is not null and "root".int_val > 10) as "result" from public.numbers as "root" where "root".id = 5
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 5
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.int_val > 10
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 5 | NULL |
Actual (Legend):
| id | result |
|---|---|
| 5 | false |
SQL (Postgres):
SELECT id, name FROM persons WHERE age <> 30 ORDER BY id
SQL (Legend, rewritten):
SELECT id, name FROM func('e2e::tds_persons') WHERE age <> 30 ORDER BY id
SQL (Generated, executed against DB):
select "root".id as "id", "root".name as "name" from public.persons as "root" where "root".age is distinct from 30 order by "id"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('age') != 30
)->meta::pure::tds::restrict(
[
'id',
'name'
]
)->meta::pure::tds::sort(
meta::pure::tds::asc('id')
)
Differences:
Expected (Postgres):
| id | name |
|---|---|
| 2 | Bob |
| 3 | Charlie |
| 4 | Diana |
| 5 | Eve |
| 6 | Frank |
| 8 | Hank |
| 9 | Ivy |
| 10 | Jack |
Actual (Legend):
| id | name |
|---|---|
| 2 | Bob |
| 3 | Charlie |
| 4 | Diana |
| 5 | Eve |
| 6 | Frank |
| 7 | Grace |
| 8 | Hank |
| 9 | Ivy |
| 10 | Jack |
SQL (Postgres):
SELECT id, name FROM persons WHERE age <> 30 ORDER BY id
SQL (Legend, rewritten):
SELECT id, name FROM func('e2e::rel_persons') WHERE age <> 30 ORDER BY id
SQL (Generated, executed against DB):
select "root".id as "id", "root".name as "name" from public.persons as "root" where "root".age is distinct from 30 order by "id"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.age != 30
)->meta::pure::functions::relation::select(
~[
id,
name
]
)->meta::pure::functions::relation::sort(
~id->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| id | name |
|---|---|
| 2 | Bob |
| 3 | Charlie |
| 4 | Diana |
| 5 | Eve |
| 6 | Frank |
| 8 | Hank |
| 9 | Ivy |
| 10 | Jack |
Actual (Legend):
| id | name |
|---|---|
| 2 | Bob |
| 3 | Charlie |
| 4 | Diana |
| 5 | Eve |
| 6 | Frank |
| 7 | Grace |
| 8 | Hank |
| 9 | Ivy |
| 10 | Jack |
SQL (Postgres):
SELECT (false AND CAST(NULL AS BOOLEAN)) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (false AND CAST(NULL AS BOOLEAN)) AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[]->meta::pure::functions::lang::cast(@Boolean),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| false |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT (false AND CAST(NULL AS BOOLEAN)) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (false AND CAST(NULL AS BOOLEAN)) AS result FROM func('e2e::rel_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|[]->meta::pure::functions::lang::cast(@Boolean)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| false |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT (true OR CAST(NULL AS BOOLEAN)) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (true OR CAST(NULL AS BOOLEAN)) AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[]->meta::pure::functions::lang::cast(@Boolean),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| true |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT (true OR CAST(NULL AS BOOLEAN)) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (true OR CAST(NULL AS BOOLEAN)) AS result FROM func('e2e::rel_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|[]->meta::pure::functions::lang::cast(@Boolean)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| true |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT json_val -> 'a' AS result FROM json_data WHERE id = 1
SQL (Legend, rewritten):
SELECT json_val -> 'a' AS result FROM func('e2e::rel_json_data') WHERE id = 1
SQL (Generated, executed against DB):
select jsonb_extract_path(cast("json_data_0".json_val as jsonb), Text'a') as "result" from public.json_data as "json_data_0" where "json_data_0".id = 1
Lambda (Pure expression):
|#>{e2e::TestDB.public.json_data}#->meta::pure::functions::relation::filter(
x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.json_val->meta::pure::functions::variant::navigation::get('a')
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 1 |
Actual (Legend):
| result |
|---|
| "1" |
SQL (Postgres):
SELECT jsonb_val -> 'b' AS result FROM json_data WHERE id = 1
SQL (Legend, rewritten):
SELECT jsonb_val -> 'b' AS result FROM func('e2e::rel_json_data') WHERE id = 1
SQL (Generated, executed against DB):
select jsonb_extract_path(cast("json_data_0".jsonb_val as jsonb), Text'b') as "result" from public.json_data as "json_data_0" where "json_data_0".id = 1
Lambda (Pure expression):
|#>{e2e::TestDB.public.json_data}#->meta::pure::functions::relation::filter(
x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.jsonb_val->meta::pure::functions::variant::navigation::get('b')
]
)
Differences:
Expected (Postgres):
| result |
|---|
| "hello" |
Actual (Legend):
| result |
|---|
| ""hello"" |
SQL (Postgres):
SELECT json_arr -> 0 AS result FROM json_data WHERE id = 1
SQL (Legend, rewritten):
SELECT json_arr -> 0 AS result FROM func('e2e::rel_json_data') WHERE id = 1
SQL (Generated, executed against DB):
select (cast("json_data_0".json_arr as jsonb)->0) as "result" from public.json_data as "json_data_0" where "json_data_0".id = 1
Lambda (Pure expression):
|#>{e2e::TestDB.public.json_data}#->meta::pure::functions::relation::filter(
x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.json_arr->meta::pure::functions::variant::navigation::get(0)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 1 |
Actual (Legend):
| result |
|---|
| "1" |
SQL (Postgres):
SELECT jsonb_arr -> 1 AS result FROM json_data WHERE id = 1
SQL (Legend, rewritten):
SELECT jsonb_arr -> 1 AS result FROM func('e2e::rel_json_data') WHERE id = 1
SQL (Generated, executed against DB):
select (cast("json_data_0".jsonb_arr as jsonb)->1) as "result" from public.json_data as "json_data_0" where "json_data_0".id = 1
Lambda (Pure expression):
|#>{e2e::TestDB.public.json_data}#->meta::pure::functions::relation::filter(
x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:meta::pure::precisePrimitives::Int[1], json_val:meta::pure::metamodel::variant::Variant, jsonb_val:meta::pure::metamodel::variant::Variant, json_arr:meta::pure::metamodel::variant::Variant, jsonb_arr:meta::pure::metamodel::variant::Variant)[1]|$x.jsonb_arr->meta::pure::functions::variant::navigation::get(1)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 2 |
Actual (Legend):
| result |
|---|
| "2" |
SQL (Postgres):
SELECT ARRAY[1,3] > ARRAY[1,2] AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT ARRAY[1, 3] > ARRAY[1, 2] AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Boolean'false' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[
1,
3
] >
[
1,
2
],
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| true |
Actual (Legend):
| result |
|---|
| false |
SQL (Postgres):
SELECT 4 || ARRAY[1,2,3] AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT 4 || ARRAY[1, 2, 3] AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Text'41' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|meta::pure::functions::string::toString(4) + [
1,
2,
3
]->meta::pure::functions::string::toString(),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| {4,1,2,3} |
Actual (Legend):
| result |
|---|
| 41 |
SQL (Postgres):
SELECT ARRAY[1,2,3] || 4 AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT ARRAY[1, 2, 3] || 4 AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Text'14' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[
1,
2,
3
]->meta::pure::functions::string::toString() + meta::pure::functions::string::toString(4),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| {1,2,3,4} |
Actual (Legend):
| result |
|---|
| 14 |
SQL (Postgres):
SELECT ARRAY[1,2] || ARRAY[3,4] AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT ARRAY[1, 2] || ARRAY[3, 4] AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Text'13' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[
1,
2
]->meta::pure::functions::string::toString() + [
3,
4
]->meta::pure::functions::string::toString(),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| {1,2,3,4} |
Actual (Legend):
| result |
|---|
| 13 |
SQL (Postgres):
SELECT id, int_val BETWEEN 0 AND 100 AS result FROM numbers WHERE id = 5
SQL (Legend, rewritten):
SELECT id, int_val BETWEEN 0 AND 100 AS result FROM func('e2e::tds_numbers') WHERE id = 5
SQL (Generated, executed against DB):
select "root".id as "id", (("root".int_val is not null and "root".int_val >= 0) and ("root".int_val is not null and "root".int_val <= 100)) as "result" from public.numbers as "root" where "root".id = 5
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.intVal,
'int_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.floatVal,
'float_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.numericVal,
'numeric_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.smallVal,
'small_val'
),
meta::pure::tds::col(
x: e2e::NumberRow[1]|$x.bigVal,
'big_val'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 5
)->meta::pure::tds::project(
[
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id'),
'id'
),
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('int_val')->meta::pure::functions::boolean::between(
0,
100
),
'result'
)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 5 | NULL |
Actual (Legend):
| id | result |
|---|---|
| 5 | false |
SQL (Postgres):
SELECT id, int_val BETWEEN 0 AND 100 AS result FROM numbers WHERE id = 5
SQL (Legend, rewritten):
SELECT id, int_val BETWEEN 0 AND 100 AS result FROM func('e2e::rel_numbers') WHERE id = 5
SQL (Generated, executed against DB):
select "root".id as "id", ((("root".int_val is not null and 0 is not null) and "root".int_val >= 0) and (("root".int_val is not null and 100 is not null) and "root".int_val <= 100)) as "result" from public.numbers as "root" where "root".id = 5
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 5
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.int_val->meta::pure::functions::boolean::between(
0,
100
)
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 5 | NULL |
Actual (Legend):
| id | result |
|---|---|
| 5 | false |
SQL (Postgres):
SELECT id, int_val IS DISTINCT FROM 42 AS result FROM numbers WHERE id = 5
SQL (Legend, rewritten):
SELECT id, int_val IS DISTINCT FROM 42 AS result FROM func('e2e::rel_numbers') WHERE id = 5
SQL (Generated, executed against DB):
select "root".id as "id", not (("root".int_val is null and 42 is null) or "root".int_val = 42) as "result" from public.numbers as "root" where "root".id = 5
Lambda (Pure expression):
|e2e::NumberRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::NumberRow[1]|$x.id,
int_val: x: e2e::NumberRow[1]|$x.intVal,
float_val: x: e2e::NumberRow[1]|$x.floatVal,
numeric_val: x: e2e::NumberRow[1]|$x.numericVal,
small_val: x: e2e::NumberRow[1]|$x.smallVal,
big_val: x: e2e::NumberRow[1]|$x.bigVal
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id == 5
)->meta::pure::functions::relation::project(
~[
id: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|$x.id,
result: x: (id:Integer[1], int_val:Integer, float_val:Float, numeric_val:Float, small_val:Integer, big_val:Integer)[1]|!(($x.int_val->meta::pure::functions::collection::isEmpty() &&
meta::pure::functions::collection::isEmpty(42)) ||
($x.int_val == 42))
]
)
Differences:
Expected (Postgres):
| id | result |
|---|---|
| 5 | true |
Actual (Legend):
| id | result |
|---|---|
| 5 | NULL |
SQL (Postgres):
SELECT to_char(TIMESTAMP '2024-06-15 13:45:22.123456', 'FF1') AS result
Differences:
Expected (Postgres):
| result |
|---|
| 1 |
Actual (Legend):
| result |
|---|
| FF1 |
SQL (Postgres):
SELECT to_char(TIMESTAMP '2024-06-15 13:45:22.123456', 'FF1') AS result
Differences:
Expected (Postgres):
| result |
|---|
| 1 |
Actual (Legend):
| result |
|---|
| FF1 |
SQL (Postgres):
SELECT to_char(TIMESTAMP '2024-06-15 13:45:22.123456', 'FF6') AS result
Differences:
Expected (Postgres):
| result |
|---|
| 123456 |
Actual (Legend):
| result |
|---|
| FF6 |
SQL (Postgres):
SELECT to_char(TIMESTAMP '2024-06-15 13:45:22.123456', 'FF6') AS result
Differences:
Expected (Postgres):
| result |
|---|
| 123456 |
Actual (Legend):
| result |
|---|
| FF6 |
SQL (Postgres):
SELECT to_char(TIMESTAMPTZ '2024-06-15 13:45:22+02', 'TZH') AS result
Differences:
Expected (Postgres):
| result |
|---|
| +00 |
Actual (Legend):
| result |
|---|
| GMTH |
SQL (Postgres):
SELECT to_char(TIMESTAMPTZ '2024-06-15 13:45:22+02', 'TZH') AS result
Differences:
Expected (Postgres):
| result |
|---|
| +00 |
Actual (Legend):
| result |
|---|
| GMTH |
SQL (Postgres):
SELECT to_char(TIMESTAMPTZ '2024-06-15 13:45:22+02', 'TZM') AS result
Differences:
Expected (Postgres):
| result |
|---|
| 00 |
Actual (Legend):
| result |
|---|
| GMTM |
SQL (Postgres):
SELECT to_char(TIMESTAMPTZ '2024-06-15 13:45:22+02', 'TZM') AS result
Differences:
Expected (Postgres):
| result |
|---|
| 00 |
Actual (Legend):
| result |
|---|
| GMTM |
SQL (Postgres):
SELECT p.name FROM persons p WHERE p.age > ALL (SELECT p2.age FROM persons p2 WHERE p2.id > 100) ORDER BY 1
SQL (Legend, rewritten):
SELECT p.name FROM func('e2e::rel_persons') p WHERE p.age > ALL(SELECT p2.age FROM func('e2e::rel_persons') p2 WHERE p2.id > 100) ORDER BY 1
SQL (Generated, executed against DB):
select "root".name as "name" from public.persons as "root" where (("root".age is not null and "root".age > all (select "persons_1".age as "age" from public.persons as "persons_1" where "persons_1".age is not null and "persons_1".id > 100)) and not exists(select 1 from public.persons as "persons_2" where "persons_2".id > 100 and "persons_2".age is null)) order by "name"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.age->meta::pure::functions::relation::greaterThanAll(
e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
e: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$e.id > 100
)->meta::pure::functions::relation::select(
~[
age
]
)
) &&
!e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
e: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$e.id > 100
)->meta::pure::functions::relation::select(
~[
age
]
)->meta::pure::functions::relation::exists(
e: (age:Integer)[1]|$e.age->meta::pure::functions::collection::isEmpty()
)
)->meta::pure::functions::relation::select(
~[
name
]
)->meta::pure::functions::relation::sort(
~name->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| name |
|---|
| Alice |
| Bob |
| Charlie |
| Diana |
| Eve |
| Frank |
| Grace |
| Hank |
| Ivy |
| Jack |
Actual (Legend):
| name |
|---|
| Alice |
| Bob |
| Charlie |
| Diana |
| Eve |
| Frank |
| Hank |
| Ivy |
| Jack |
SQL (Postgres):
SELECT (NULL = NULL) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (NULL = NULL) AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Boolean'true' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[] ==
[],
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| NULL |
Actual (Legend):
| result |
|---|
| true |
SQL (Postgres):
SELECT (NULL <> 1) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (NULL <> 1) AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select Boolean'true' as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[] != 1,
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| NULL |
Actual (Legend):
| result |
|---|
| true |
SQL (Postgres):
SELECT name || ' age=' || CAST(age AS TEXT) AS result FROM persons ORDER BY 1
SQL (Legend, rewritten):
SELECT name || ' age=' || CAST(age AS TEXT) AS result FROM func('e2e::tds_persons') ORDER BY 1
SQL (Generated, executed against DB):
select concat("root".name,'',Text' age=','',cast("root".age as varchar)) as "result" from public.persons as "root" order by "result"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getString('name') + ' age=' + $row.getInteger('age')->meta::pure::functions::string::toString(),
'result'
)
)->meta::pure::tds::sort(
meta::pure::tds::asc('result')
)
Differences:
Expected (Postgres):
| result |
|---|
| Alice age=30 |
| Bob age=25 |
| Charlie age=35 |
| Diana age=28 |
| Eve age=45 |
| Frank age=32 |
| Hank age=50 |
| Ivy age=22 |
| Jack age=38 |
| NULL |
Actual (Legend):
| result |
|---|
| Alice age=30 |
| Bob age=25 |
| Charlie age=35 |
| Diana age=28 |
| Eve age=45 |
| Frank age=32 |
| Grace age= |
| Hank age=50 |
| Ivy age=22 |
| Jack age=38 |
SQL (Postgres):
SELECT name || ' age=' || CAST(age AS TEXT) AS result FROM persons ORDER BY 1
SQL (Legend, rewritten):
SELECT name || ' age=' || CAST(age AS TEXT) AS result FROM func('e2e::rel_persons') ORDER BY 1
SQL (Generated, executed against DB):
select case when "root".name is null then null else concat("root".name, Text' age=', cast("root".age as varchar)) end as "result" from public.persons as "root" order by "result"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|if(
$x.name->meta::pure::functions::collection::isEmpty(),
|[],
|$x.name->meta::pure::functions::multiplicity::toOne() + ' age=' + $x.age->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::string::toString()
)
]
)->meta::pure::functions::relation::sort(
~result->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| result |
|---|
| Alice age=30 |
| Bob age=25 |
| Charlie age=35 |
| Diana age=28 |
| Eve age=45 |
| Frank age=32 |
| Hank age=50 |
| Ivy age=22 |
| Jack age=38 |
| NULL |
Actual (Legend):
| result |
|---|
| Alice age=30 |
| Bob age=25 |
| Charlie age=35 |
| Diana age=28 |
| Eve age=45 |
| Frank age=32 |
| Grace age= |
| Hank age=50 |
| Ivy age=22 |
| Jack age=38 |
SQL (Postgres):
SELECT name, salary FROM persons WHERE salary NOT BETWEEN 40000 AND 60000 ORDER BY 1
SQL (Legend, rewritten):
SELECT name, salary FROM func('e2e::tds_persons') WHERE salary NOT BETWEEN 40000 AND 60000 ORDER BY 1
SQL (Generated, executed against DB):
select "root".name as "name", "root".salary as "salary" from public.persons as "root" where not (("root".salary is not null and "root".salary >= 40000) and ("root".salary is not null and "root".salary <= 60000)) order by "name"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|!$row.getFloat('salary')->meta::pure::functions::boolean::between(
40000,
60000
)
)->meta::pure::tds::restrict(
[
'name',
'salary'
]
)->meta::pure::tds::sort(
meta::pure::tds::asc('name')
)
Differences:
Expected (Postgres):
| name | salary |
|---|---|
| Bob | 60000.50 |
| Charlie | 75000.75 |
| Diana | 80000.25 |
| Eve | 95000.00 |
| Grace | 70000.00 |
| Jack | 120000.00 |
Actual (Legend):
| name | salary |
|---|---|
| Bob | 60000.5 |
| Charlie | 75000.75 |
| Diana | 80000.25 |
| Eve | 95000.0 |
| Grace | 70000.0 |
| Hank | NULL |
| Jack | 120000.0 |
SQL (Postgres):
SELECT name, salary FROM persons WHERE salary NOT BETWEEN 40000 AND 60000 ORDER BY 1
SQL (Legend, rewritten):
SELECT name, salary FROM func('e2e::rel_persons') WHERE salary NOT BETWEEN 40000 AND 60000 ORDER BY 1
SQL (Generated, executed against DB):
select "root".name as "name", "root".salary as "salary" from public.persons as "root" where not (("root".salary is not null and "root".salary >= 40000) and ("root".salary is not null and "root".salary <= 60000)) order by "name"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|!$x.salary->meta::pure::functions::boolean::between(
40000,
60000
)
)->meta::pure::functions::relation::select(
~[
name,
salary
]
)->meta::pure::functions::relation::sort(
~name->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| name | salary |
|---|---|
| Bob | 60000.50 |
| Charlie | 75000.75 |
| Diana | 80000.25 |
| Eve | 95000.00 |
| Grace | 70000.00 |
| Jack | 120000.00 |
Actual (Legend):
| name | salary |
|---|---|
| Bob | 60000.5 |
| Charlie | 75000.75 |
| Diana | 80000.25 |
| Eve | 95000.0 |
| Grace | 70000.0 |
| Hank | NULL |
| Jack | 120000.0 |
SQL (Postgres):
SELECT name, dept_id FROM persons WHERE dept_id NOT IN (1, 2) ORDER BY 1
SQL (Legend, rewritten):
SELECT name, dept_id FROM func('e2e::tds_persons') WHERE dept_id NOT IN (1, 2) ORDER BY 1
SQL (Generated, executed against DB):
select "root".name as "name", "root".dept_id as "dept_id" from public.persons as "root" where ("root".dept_id not in (1, 2) OR "root".dept_id is null) order by "name"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|!$row.getInteger('dept_id')->meta::pure::functions::collection::in(
[
1,
2
]
)
)->meta::pure::tds::restrict(
[
'name',
'dept_id'
]
)->meta::pure::tds::sort(
meta::pure::tds::asc('name')
)
Differences:
Expected (Postgres):
| name | dept_id |
|---|---|
| Eve | 3 |
| Frank | 3 |
| Jack | 3 |
Actual (Legend):
| name | dept_id |
|---|---|
| Eve | 3 |
| Frank | 3 |
| Grace | NULL |
| Jack | 3 |
SQL (Postgres):
SELECT name, dept_id FROM persons WHERE dept_id NOT IN (1, 2) ORDER BY 1
SQL (Legend, rewritten):
SELECT name, dept_id FROM func('e2e::rel_persons') WHERE dept_id NOT IN (1, 2) ORDER BY 1
SQL (Generated, executed against DB):
select "root".name as "name", "root".dept_id as "dept_id" from public.persons as "root" where ("root".dept_id not in (1, 2) OR "root".dept_id is null) order by "name"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|!$x.dept_id->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::collection::in(
[
1,
2
]
)
)->meta::pure::functions::relation::select(
~[
name,
dept_id
]
)->meta::pure::functions::relation::sort(
~name->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| name | dept_id |
|---|---|
| Eve | 3 |
| Frank | 3 |
| Jack | 3 |
Actual (Legend):
| name | dept_id |
|---|---|
| Eve | 3 |
| Frank | 3 |
| Grace | NULL |
| Jack | 3 |
SQL (Postgres):
SELECT name FROM persons WHERE NOT (dept_id = 1 AND salary > 50000) ORDER BY 1
SQL (Legend, rewritten):
SELECT name FROM func('e2e::rel_persons') WHERE NOT (dept_id = 1 AND salary > 50000) ORDER BY 1
SQL (Generated, executed against DB):
select "root".name as "name" from public.persons as "root" where not ("root".dept_id = 1 and ("root".salary is not null and "root".salary > 50000)) order by "name"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|!(($x.dept_id == 1) &&
($x.salary > 50000))
)->meta::pure::functions::relation::select(
~[
name
]
)->meta::pure::functions::relation::sort(
~name->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| name |
|---|
| Alice |
| Charlie |
| Diana |
| Eve |
| Frank |
| Ivy |
| Jack |
Actual (Legend):
| name |
|---|
| Alice |
| Charlie |
| Diana |
| Eve |
| Frank |
| Hank |
| Ivy |
| Jack |
SQL (Postgres):
SELECT (NULL AND FALSE) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (NULL AND FALSE) AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[]->meta::pure::functions::lang::cast(@Boolean),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| false |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT (NULL AND FALSE) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (NULL AND FALSE) AS result FROM func('e2e::rel_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|[]->meta::pure::functions::lang::cast(@Boolean)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| false |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT (NULL OR TRUE) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (NULL OR TRUE) AS result FROM func('e2e::tds_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id') == 1
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|[]->meta::pure::functions::lang::cast(@Boolean),
'result'
)
)
Differences:
Expected (Postgres):
| result |
|---|
| true |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT (NULL OR TRUE) AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT (NULL OR TRUE) AS result FROM func('e2e::rel_persons') WHERE id = 1
SQL (Generated, executed against DB):
select null as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|[]->meta::pure::functions::lang::cast(@Boolean)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| true |
Actual (Legend):
| result |
|---|
| NULL |
SQL (Postgres):
SELECT p.*, d.* FROM persons p JOIN departments d ON p.dept_id = d.id WHERE p.id <= 3 ORDER BY p.id
SQL (Legend, rewritten):
SELECT p.*, d.* FROM func('e2e::tds_persons') p JOIN func('e2e::tds_departments') d ON p.dept_id = d.id WHERE p.id <= 3 ORDER BY p.id
SQL (Generated, executed against DB):
select "persons_0"."id_p" as "id", "persons_0"."name_p" as "name", "persons_0"."age_p" as "age", "persons_0"."salary_p" as "salary", "persons_0"."hire_date_p" as "hire_date", "persons_0"."active_p" as "active", "persons_0"."dept_id_p" as "dept_id", "persons_0"."budget_d" as "budget", "persons_0"."created_at_d" as "created_at" from (select "persons_1"."id_p" as "id_p", "persons_1"."name_p" as "name_p", "persons_1"."age_p" as "age_p", "persons_1"."salary_p" as "salary_p", "persons_1"."hire_date_p" as "hire_date_p", "persons_1"."active_p" as "active_p", "persons_1"."dept_id_p" as "dept_id_p", "persons_1"."budget_d" as "budget_d", "persons_1"."created_at_d" as "created_at_d" from (select * from (select "persons_3"."id" as "id_p", "persons_3"."name" as "name_p", "persons_3"."age" as "age_p", "persons_3"."salary" as "salary_p", "persons_3"."hire_date" as "hire_date_p", "persons_3"."active" as "active_p", "persons_3"."dept_id" as "dept_id_p" from (select "root".id as "id", "root".name as "name", "root".age as "age", "root".salary as "salary", "root".hire_date as "hire_date", "root".active as "active", "root".dept_id as "dept_id" from public.persons as "root") as "persons_3") as "persons_2" inner join (select "departments_1"."id" as "id_d", "departments_1"."name" as "name_d", "departments_1"."budget" as "budget_d", "departments_1"."created_at" as "created_at_d" from (select "root".id as "id", "root".name as "name", "root".budget as "budget", "root".created_at as "created_at" from public.departments as "root") as "departments_1") as "departments_0" on ("persons_2"."dept_id_p" = "departments_0"."id_d")) as "persons_1" where "persons_1"."id_p" <= 3 order by "id_p") as "persons_0"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Person[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.age,
'age'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.salary,
'salary'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.hireDate,
'hire_date'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.active,
'active'
),
meta::pure::tds::col(
x: e2e::Person[1]|$x.deptId,
'dept_id'
)
]
)->meta::pure::tds::renameColumns(
[
'id'->meta::pure::functions::collection::pair('id_p'),
'name'->meta::pure::functions::collection::pair('name_p'),
'age'->meta::pure::functions::collection::pair('age_p'),
'salary'->meta::pure::functions::collection::pair('salary_p'),
'hire_date'->meta::pure::functions::collection::pair('hire_date_p'),
'active'->meta::pure::functions::collection::pair('active_p'),
'dept_id'->meta::pure::functions::collection::pair('dept_id_p')
]
)->meta::pure::tds::join(
e2e::Department.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::Department[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::Department[1]|$x.name,
'name'
),
meta::pure::tds::col(
x: e2e::Department[1]|$x.budget,
'budget'
),
meta::pure::tds::col(
x: e2e::Department[1]|$x.createdAt,
'created_at'
)
]
)->meta::pure::tds::renameColumns(
[
'id'->meta::pure::functions::collection::pair('id_d'),
'name'->meta::pure::functions::collection::pair('name_d'),
'budget'->meta::pure::functions::collection::pair('budget_d'),
'created_at'->meta::pure::functions::collection::pair('created_at_d')
]
),
meta::relational::metamodel::join::JoinType.INNER,
{row1: meta::pure::tds::TDSRow[1], row2: meta::pure::tds::TDSRow[1]|$row1.getInteger('dept_id_p') ==
$row2.getInteger('id_d') }
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getInteger('id_p') <= 3
)->meta::pure::tds::sort(
meta::pure::tds::asc('id_p')
)->meta::pure::tds::restrict(
[
'id_p',
'name_p',
'age_p',
'salary_p',
'hire_date_p',
'active_p',
'dept_id_p',
'budget_d',
'created_at_d'
]
)->meta::pure::tds::renameColumns(
[
'id_p'->meta::pure::functions::collection::pair('id'),
'name_p'->meta::pure::functions::collection::pair('name'),
'age_p'->meta::pure::functions::collection::pair('age'),
'salary_p'->meta::pure::functions::collection::pair('salary'),
'hire_date_p'->meta::pure::functions::collection::pair('hire_date'),
'active_p'->meta::pure::functions::collection::pair('active'),
'dept_id_p'->meta::pure::functions::collection::pair('dept_id'),
'budget_d'->meta::pure::functions::collection::pair('budget'),
'created_at_d'->meta::pure::functions::collection::pair('created_at')
]
)
Differences:
Expected (Postgres):
| id | name | age | salary | hire_date | active | dept_id | id | name | budget | created_at |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Alice | 30 | 50000.00 | 2020-01-15 | true | 1 | 1 | Engineering | 1000000.00 | 2015-01-01 09:00:00.0 |
| 2 | Bob | 25 | 60000.50 | 2021-03-20 | true | 1 | 1 | Engineering | 1000000.00 | 2015-01-01 09:00:00.0 |
| 3 | Charlie | 35 | 75000.75 | 2019-06-10 | false | 2 | 2 | Marketing | 500000.00 | 2016-06-15 10:30:00.0 |
Actual (Legend):
| id | name | age | salary | hire_date | active | dept_id | budget | created_at |
|---|---|---|---|---|---|---|---|---|
| 1 | Alice | 30 | 50000.0 | 2020-01-15 | true | 1 | 1000000.0 | 2015-01-01 09:00:00.0 |
| 2 | Bob | 25 | 60000.5 | 2021-03-20 | true | 1 | 1000000.0 | 2015-01-01 09:00:00.0 |
| 3 | Charlie | 35 | 75000.75 | 2019-06-10 | false | 2 | 500000.0 | 2016-06-15 10:30:00.0 |
SQL (Postgres):
SELECT p.*, d.* FROM persons p JOIN departments d ON p.dept_id = d.id WHERE p.id <= 3 ORDER BY p.id
SQL (Legend, rewritten):
SELECT p.*, d.* FROM func('e2e::rel_persons') p JOIN func('e2e::rel_departments') d ON p.dept_id = d.id WHERE p.id <= 3 ORDER BY p.id
SQL (Generated, executed against DB):
select "persons_0"."id_p" as "id", "persons_0"."name_p" as "name", "persons_0"."age_p" as "age", "persons_0"."salary_p" as "salary", "persons_0"."hire_date_p" as "hire_date", "persons_0"."active_p" as "active", "persons_0"."dept_id_p" as "dept_id", "persons_0"."budget_d" as "budget", "persons_0"."created_at_d" as "created_at" from (select "persons_1"."id_p" as "id_p", "persons_1"."name_p" as "name_p", "persons_1"."age_p" as "age_p", "persons_1"."salary_p" as "salary_p", "persons_1"."hire_date_p" as "hire_date_p", "persons_1"."active_p" as "active_p", "persons_1"."dept_id_p" as "dept_id_p", "persons_1"."budget_d" as "budget_d", "persons_1"."created_at_d" as "created_at_d" from (select * from (select "persons_3"."id" as "id_p", "persons_3"."name" as "name_p", "persons_3"."age" as "age_p", "persons_3"."salary" as "salary_p", "persons_3"."hire_date" as "hire_date_p", "persons_3"."active" as "active_p", "persons_3"."dept_id" as "dept_id_p" from (select "root".id as "id", "root".name as "name", "root".age as "age", "root".salary as "salary", "root".hire_date as "hire_date", "root".active as "active", "root".dept_id as "dept_id" from public.persons as "root") as "persons_3") as "persons_2" inner join (select "departments_1"."id" as "id_d", "departments_1"."name" as "name_d", "departments_1"."budget" as "budget_d", "departments_1"."created_at" as "created_at_d" from (select "root".id as "id", "root".name as "name", "root".budget as "budget", "root".created_at as "created_at" from public.departments as "root") as "departments_1") as "departments_0" on ("persons_2"."dept_id_p" = "departments_0"."id_d")) as "persons_1" where "persons_1"."id_p" <= 3 order by "id_p") as "persons_0"
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::rename(
~id,
~id_p
)->meta::pure::functions::relation::rename(
~name,
~name_p
)->meta::pure::functions::relation::rename(
~age,
~age_p
)->meta::pure::functions::relation::rename(
~salary,
~salary_p
)->meta::pure::functions::relation::rename(
~hire_date,
~hire_date_p
)->meta::pure::functions::relation::rename(
~active,
~active_p
)->meta::pure::functions::relation::rename(
~dept_id,
~dept_id_p
)->meta::pure::functions::relation::join(
e2e::Department.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Department[1]|$x.id,
name: x: e2e::Department[1]|$x.name,
budget: x: e2e::Department[1]|$x.budget,
created_at: x: e2e::Department[1]|$x.createdAt
]
)->meta::pure::functions::relation::rename(
~id,
~id_d
)->meta::pure::functions::relation::rename(
~name,
~name_d
)->meta::pure::functions::relation::rename(
~budget,
~budget_d
)->meta::pure::functions::relation::rename(
~created_at,
~created_at_d
),
meta::pure::functions::relation::JoinKind.INNER,
{row1: (id_p:Integer[1], name_p:String, age_p:Integer, salary_p:Float, hire_date_p:StrictDate, active_p:Boolean, dept_id_p:Integer)[1], row2: (id_d:Integer[1], name_d:String, budget_d:Float, created_at_d:DateTime)[1]|$row1.dept_id_p ==
$row2.id_d }
)->meta::pure::functions::relation::filter(
x: (id_p:Integer[1], name_p:String, age_p:Integer, salary_p:Float, hire_date_p:StrictDate, active_p:Boolean, dept_id_p:Integer, id_d:Integer[1], name_d:String, budget_d:Float, created_at_d:DateTime)[1]|$x.id_p <= 3
)->meta::pure::functions::relation::sort(
~id_p->meta::pure::functions::relation::ascending()
)->meta::pure::functions::relation::select(
~[
id_p,
name_p,
age_p,
salary_p,
hire_date_p,
active_p,
dept_id_p,
budget_d,
created_at_d
]
)->meta::pure::functions::relation::rename(
~id_p,
~id
)->meta::pure::functions::relation::rename(
~name_p,
~name
)->meta::pure::functions::relation::rename(
~age_p,
~age
)->meta::pure::functions::relation::rename(
~salary_p,
~salary
)->meta::pure::functions::relation::rename(
~hire_date_p,
~hire_date
)->meta::pure::functions::relation::rename(
~active_p,
~active
)->meta::pure::functions::relation::rename(
~dept_id_p,
~dept_id
)->meta::pure::functions::relation::rename(
~budget_d,
~budget
)->meta::pure::functions::relation::rename(
~created_at_d,
~created_at
)
Differences:
Expected (Postgres):
| id | name | age | salary | hire_date | active | dept_id | id | name | budget | created_at |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Alice | 30 | 50000.00 | 2020-01-15 | true | 1 | 1 | Engineering | 1000000.00 | 2015-01-01 09:00:00.0 |
| 2 | Bob | 25 | 60000.50 | 2021-03-20 | true | 1 | 1 | Engineering | 1000000.00 | 2015-01-01 09:00:00.0 |
| 3 | Charlie | 35 | 75000.75 | 2019-06-10 | false | 2 | 2 | Marketing | 500000.00 | 2016-06-15 10:30:00.0 |
Actual (Legend):
| id | name | age | salary | hire_date | active | dept_id | budget | created_at |
|---|---|---|---|---|---|---|---|---|
| 1 | Alice | 30 | 50000.0 | 2020-01-15 | true | 1 | 1000000.0 | 2015-01-01 09:00:00.0 |
| 2 | Bob | 25 | 60000.5 | 2021-03-20 | true | 1 | 1000000.0 | 2015-01-01 09:00:00.0 |
| 3 | Charlie | 35 | 75000.75 | 2019-06-10 | false | 2 | 500000.0 | 2016-06-15 10:30:00.0 |
SQL (Postgres):
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY 1
Differences:
Expected (Postgres):
| table_name |
|---|
| dates |
| departments |
| empty_table |
| json_data |
| numbers |
| orders |
| persons |
| strings |
Actual (Legend):
| table_name |
|---|
SQL (Postgres):
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY 1
Differences:
Expected (Postgres):
| table_name |
|---|
| dates |
| departments |
| empty_table |
| json_data |
| numbers |
| orders |
| persons |
| strings |
Actual (Legend):
| table_name |
|---|
SQL (Postgres):
SELECT column_name FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'persons' ORDER BY 1
Differences:
Expected (Postgres):
| column_name |
|---|
| active |
| age |
| dept_id |
| hire_date |
| id |
| name |
| salary |
Actual (Legend):
| column_name |
|---|
SQL (Postgres):
SELECT column_name FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'persons' ORDER BY 1
Differences:
Expected (Postgres):
| column_name |
|---|
| active |
| age |
| dept_id |
| hire_date |
| id |
| name |
| salary |
Actual (Legend):
| column_name |
|---|
SQL (Postgres):
SELECT '[10,20,30]'::jsonb -> 1 AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT '[10,20,30]'::jsonb -> 1 AS result FROM func('e2e::rel_persons') WHERE id = 1
SQL (Generated, executed against DB):
select (cast(cast(Text'[10,20,30]' as JSONB) as jsonb)->1) as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|meta::pure::functions::variant::convert::fromJson('[10,20,30]')->meta::pure::functions::variant::navigation::get(1)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 20 |
Actual (Legend):
| result |
|---|
| "20" |
SQL (Postgres):
SELECT '[10,20,30]'::jsonb -> -1 AS result FROM persons WHERE id = 1
SQL (Legend, rewritten):
SELECT '[10,20,30]'::jsonb -> -1 AS result FROM func('e2e::rel_persons') WHERE id = 1
SQL (Generated, executed against DB):
select (cast(cast(Text'[10,20,30]' as JSONB) as jsonb)->-1) as "result" from public.persons as "root" where "root".id = 1
Lambda (Pure expression):
|e2e::Person.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::Person[1]|$x.id,
name: x: e2e::Person[1]|$x.name,
age: x: e2e::Person[1]|$x.age,
salary: x: e2e::Person[1]|$x.salary,
hire_date: x: e2e::Person[1]|$x.hireDate,
active: x: e2e::Person[1]|$x.active,
dept_id: x: e2e::Person[1]|$x.deptId
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|$x.id == 1
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], name:String, age:Integer, salary:Float, hire_date:StrictDate, active:Boolean, dept_id:Integer)[1]|meta::pure::functions::variant::convert::fromJson('[10,20,30]')->meta::pure::functions::variant::navigation::get(
-1
)
]
)
Differences:
Expected (Postgres):
| result |
|---|
| 30 |
Actual (Legend):
| result |
|---|
| "30" |
SQL (Postgres):
SELECT d + INTERVAL '1 year 2 months 3 days' AS result FROM dates WHERE d IS NOT NULL ORDER BY 1
SQL (Legend, rewritten):
SELECT d + INTERVAL '1 year 2 months 3 days' AS result FROM func('e2e::tds_dates') WHERE d IS NOT NULL ORDER BY 1
SQL (Generated, executed against DB):
select ((("root".d + (INTERVAL '1 YEARS' * 1)) + (INTERVAL '1 MONTHS' * 2)) + (INTERVAL '1 DAYS' * 3)) as "result" from public.dates as "root" where "root".d is not null order by "result"
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::tds::project(
[
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.id,
'id'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.d,
'd'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.ts,
'ts'
),
meta::pure::tds::col(
x: e2e::DateRow[1]|$x.tsz,
'tsz'
)
]
)->meta::pure::tds::filter(
row: meta::pure::tds::TDSRow[1]|$row.getStrictDate('d')->meta::pure::functions::collection::isNotEmpty()
)->meta::pure::tds::project(
meta::pure::tds::col(
row: meta::pure::tds::TDSRow[1]|$row.getStrictDate('d')->meta::pure::functions::date::adjust(
1,
meta::pure::functions::date::DurationUnit.YEARS
)->meta::pure::functions::date::adjust(
2,
meta::pure::functions::date::DurationUnit.MONTHS
)->meta::pure::functions::date::adjust(
3,
meta::pure::functions::date::DurationUnit.DAYS
),
'result'
)
)->meta::pure::tds::sort(
meta::pure::tds::asc('result')
)
Differences:
Expected (Postgres):
| result |
|---|
| 1971-03-04 00:00:00.0 |
| 2001-03-03 00:00:00.0 |
| 2001-03-04 00:00:00.0 |
| 2021-05-02 00:00:00.0 |
| 2024-03-18 00:00:00.0 |
| 2024-09-07 00:00:00.0 |
| 2025-08-18 00:00:00.0 |
| 2027-02-28 00:00:00.0 |
| 2027-03-04 00:00:00.0 |
Actual (Legend):
| result |
|---|
| 1971-03-04 00:00:00.0 |
| 2001-03-03 00:00:00.0 |
| 2001-03-04 00:00:00.0 |
| 2021-05-01 00:00:00.0 |
| 2024-03-18 00:00:00.0 |
| 2024-09-07 00:00:00.0 |
| 2025-08-18 00:00:00.0 |
| 2027-02-28 00:00:00.0 |
| 2027-03-04 00:00:00.0 |
SQL (Postgres):
SELECT d + INTERVAL '1 year 2 months 3 days' AS result FROM dates WHERE d IS NOT NULL ORDER BY 1
SQL (Legend, rewritten):
SELECT d + INTERVAL '1 year 2 months 3 days' AS result FROM func('e2e::rel_dates') WHERE d IS NOT NULL ORDER BY 1
SQL (Generated, executed against DB):
select ((("root".d + (INTERVAL '1 YEARS' * 1)) + (INTERVAL '1 MONTHS' * 2)) + (INTERVAL '1 DAYS' * 3)) as "result" from public.dates as "root" where "root".d is not null order by "result"
Lambda (Pure expression):
|e2e::DateRow.all()->meta::pure::functions::relation::project(
~[
id: x: e2e::DateRow[1]|$x.id,
d: x: e2e::DateRow[1]|$x.d,
ts: x: e2e::DateRow[1]|$x.ts,
tsz: x: e2e::DateRow[1]|$x.tsz
]
)->meta::pure::functions::relation::filter(
x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|$x.d->meta::pure::functions::collection::isNotEmpty()
)->meta::pure::functions::relation::project(
~[
result: x: (id:Integer[1], d:StrictDate, ts:DateTime, tsz:DateTime)[1]|$x.d->meta::pure::functions::multiplicity::toOne()->meta::pure::functions::date::adjust(
1,
meta::pure::functions::date::DurationUnit.YEARS
)->meta::pure::functions::date::adjust(
2,
meta::pure::functions::date::DurationUnit.MONTHS
)->meta::pure::functions::date::adjust(
3,
meta::pure::functions::date::DurationUnit.DAYS
)
]
)->meta::pure::functions::relation::sort(
~result->meta::pure::functions::relation::ascending()
)
Differences:
Expected (Postgres):
| result |
|---|
| 1971-03-04 00:00:00.0 |
| 2001-03-03 00:00:00.0 |
| 2001-03-04 00:00:00.0 |
| 2021-05-02 00:00:00.0 |
| 2024-03-18 00:00:00.0 |
| 2024-09-07 00:00:00.0 |
| 2025-08-18 00:00:00.0 |
| 2027-02-28 00:00:00.0 |
| 2027-03-04 00:00:00.0 |
Actual (Legend):
| result |
|---|
| 1971-03-04 00:00:00.0 |
| 2001-03-03 00:00:00.0 |
| 2001-03-04 00:00:00.0 |
| 2021-05-01 00:00:00.0 |
| 2024-03-18 00:00:00.0 |
| 2024-09-07 00:00:00.0 |
| 2025-08-18 00:00:00.0 |
| 2027-02-28 00:00:00.0 |
| 2027-03-04 00:00:00.0 |