mirror of
https://github.com/jackfoxy/urQL.git
synced 2024-08-16 23:30:51 +03:00
set up data manipulations for as-of
This commit is contained in:
parent
aceef91aa8
commit
c680d33886
@ -11,6 +11,12 @@ Deletes rows from a `<table-set>`.
|
||||
<delete> ::=
|
||||
DELETE [ FROM ] <table-set>
|
||||
[ WHERE <predicate> ]
|
||||
[ AS OF { NOW
|
||||
| <timestamp>
|
||||
| n { SECONDS | MINUTES | HOURS | DAYS | WEEKS | MONTHS | YEARS } AGO
|
||||
| <inline-scalar>
|
||||
}
|
||||
]
|
||||
```
|
||||
## API
|
||||
```
|
||||
@ -59,6 +65,12 @@ Inserts rows into a `<table-set>`.
|
||||
[ ( <column> [ ,...n ] ) ]
|
||||
{ VALUES (<scalar-expression> [ ,...n ] ) [ ...n ]
|
||||
| <transform> }
|
||||
[ AS OF { NOW
|
||||
| <timestamp>
|
||||
| n { SECONDS | MINUTES | HOURS | DAYS | WEEKS | MONTHS | YEARS } AGO
|
||||
| <inline-scalar>
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
```
|
||||
@ -137,6 +149,12 @@ Removes all rows in a base table.
|
||||
```
|
||||
<truncate-table> ::=
|
||||
TRUNCATE TABLE [ <ship-qualifier> ] <table>
|
||||
[ AS OF { NOW
|
||||
| <timestamp>
|
||||
| n { SECONDS | MINUTES | HOURS | DAYS | WEEKS | MONTHS | YEARS } AGO
|
||||
| <inline-scalar>
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## API
|
||||
@ -177,6 +195,12 @@ Changes content of selected columns in existing rows of a `<table-set>`.
|
||||
UPDATE [ <ship-qualifier> ] <table-set>
|
||||
SET { <column> = <scalar-expression> } [ ,...n ]
|
||||
[ WHERE <predicate> ]
|
||||
[ AS OF { NOW
|
||||
| <timestamp>
|
||||
| n { SECONDS | MINUTES | HOURS | DAYS | WEEKS | MONTHS | YEARS } AGO
|
||||
| <inline-scalar>
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## API
|
||||
|
@ -39,6 +39,12 @@ If the resulting virtual-table row type is a union type, then the output must be
|
||||
THEN <merge-not-matched> ] [ ...n ]
|
||||
[ WHEN NOT MATCHED BY SOURCE [ AND <unmatched-source-predicate> ]
|
||||
THEN <merge-matched> ] [ ...n ]
|
||||
[ AS OF { NOW
|
||||
| <timestamp>
|
||||
| n { SECONDS | MINUTES | HOURS | DAYS | WEEKS | MONTHS | YEARS } AGO
|
||||
| <inline-scalar>
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
```
|
||||
|
@ -605,7 +605,7 @@
|
||||
%= $
|
||||
script q.q.u.+3.q:truncate-table-nail
|
||||
commands
|
||||
[`command:ast`(truncate-table:ast %truncate-table (wonk truncate-table-nail)) commands]
|
||||
[`command:ast`(truncate-table:ast %truncate-table (wonk truncate-table-nail) ~) commands]
|
||||
==
|
||||
%update
|
||||
~| "update error: {<`tape`(scag 100 q.q.command-nail)>} ..."
|
||||
@ -915,9 +915,9 @@
|
||||
|= a=*
|
||||
^- insert:ast
|
||||
?: ?=([[@ @ @ @ @] @ *] a) ::"insert rows"
|
||||
(insert:ast %insert -.a ~ (insert-values:ast %data +>-.a))
|
||||
(insert:ast %insert -.a ~ (insert-values:ast %data +>-.a) ~)
|
||||
?: ?=([[@ @ @ @ @] [* @] *] a) ::"insert column names rows"
|
||||
(insert:ast %insert -.a `+<-.a (insert-values:ast %data +>-.a))
|
||||
(insert:ast %insert -.a `+<-.a (insert-values:ast %data +>-.a) ~)
|
||||
~|("Cannot parse insert {<a>}" !!)
|
||||
++ produce-merge
|
||||
|= a=*
|
||||
@ -930,7 +930,7 @@
|
||||
=/ matching=[matched=(list matching:ast) not-target=(list matching:ast) not-source=(list matching:ast)] [~ ~ ~]
|
||||
|-
|
||||
?~ a ?: ?&(=(target-table ~) =(source-table ~)) ~|("target and source tables cannot both be pass through" !!)
|
||||
(merge:ast %merge (need target-table) new-table (need source-table) (need predicate) matched=matched.matching unmatched-by-target=not-target.matching unmatched-by-source=not-source.matching)
|
||||
(merge:ast %merge (need target-table) new-table (need source-table) (need predicate) matched=matched.matching unmatched-by-target=not-target.matching unmatched-by-source=not-source.matching ~)
|
||||
?: ?=(qualified-object:ast -.a)
|
||||
%= $
|
||||
a +.a
|
||||
@ -1081,8 +1081,8 @@
|
||||
=/ table=qualified-object:ast ?>(?=(qualified-object:ast -.a) -.a)
|
||||
=/ columns-values=[(list @t) (list datum:ast)] (produce-column-sets +>-.a)
|
||||
?~ +>+.a
|
||||
(update:ast %update table -.columns-values +.columns-values ~)
|
||||
(update:ast %update table -.columns-values +.columns-values `(produce-predicate (predicate-list +>+.a)))
|
||||
(update:ast %update table -.columns-values +.columns-values ~ ~)
|
||||
(update:ast %update table -.columns-values +.columns-values `(produce-predicate (predicate-list +>+.a)) ~)
|
||||
++ update-column ;~ pose
|
||||
;~(pfix whitespace ;~(sfix update-column-inner whitespace))
|
||||
;~(pfix whitespace update-column-inner)
|
||||
@ -2286,10 +2286,10 @@
|
||||
^- delete:ast
|
||||
?> ?=(qualified-object:ast -.a)
|
||||
?: =(%end-command +<.a)
|
||||
(delete:ast %delete -.a ~)
|
||||
(delete:ast %delete -.a ~ ~)
|
||||
?: =(%where +<.a)
|
||||
(delete:ast %delete -.a `(produce-predicate (predicate-list +>-.a)))
|
||||
(delete:ast %delete -.a `(produce-predicate (predicate-list +>->.a)))
|
||||
(delete:ast %delete -.a `(produce-predicate (predicate-list +>-.a)) ~)
|
||||
(delete:ast %delete -.a `(produce-predicate (predicate-list +>->.a)) ~)
|
||||
++ produce-select
|
||||
|= a=*
|
||||
^- select:ast
|
||||
|
@ -271,6 +271,7 @@
|
||||
%delete
|
||||
table=qualified-object
|
||||
predicate=(unit predicate)
|
||||
as-of=(unit as-of)
|
||||
==
|
||||
+$ insert-values $%([%data (list (list value-or-default))] [%query query])
|
||||
::
|
||||
@ -281,6 +282,7 @@
|
||||
table=qualified-object
|
||||
columns=(unit (list @t))
|
||||
values=insert-values
|
||||
as-of=(unit as-of)
|
||||
==
|
||||
+$ value-or-default ?(%default datum)
|
||||
::
|
||||
@ -292,6 +294,7 @@
|
||||
columns=(list @t)
|
||||
values=(list value-or-default)
|
||||
predicate=(unit predicate)
|
||||
as-of=(unit as-of)
|
||||
==
|
||||
::
|
||||
:: $merge: merge from source table-set into target table-set
|
||||
@ -305,6 +308,7 @@
|
||||
matched=(list matching)
|
||||
unmatched-by-target=(list matching)
|
||||
unmatched-by-source=(list matching)
|
||||
as-of=(unit as-of)
|
||||
==
|
||||
+$ matching
|
||||
$:
|
||||
@ -321,6 +325,7 @@
|
||||
$:
|
||||
%truncate-table
|
||||
table=qualified-object
|
||||
as-of=(unit as-of)
|
||||
==
|
||||
::
|
||||
:: create ASTs
|
||||
|
@ -3,78 +3,62 @@
|
||||
|%
|
||||
|
||||
::
|
||||
:: name, as of now
|
||||
++ test-drop-namespace-03
|
||||
:: tests 1, 2, 3, 5, and extra whitespace characters
|
||||
++ test-truncate-table-1
|
||||
=/ expected1 [%truncate-table table=[%qualified-object ship=[~ ~zod] database='db' namespace='ns' name='name'] ~]
|
||||
=/ expected2 [%truncate-table table=[%qualified-object ship=[~ ~sampel-palnet] database='db' namespace='dbo' name='name'] ~]
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=~]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of now")
|
||||
!> ~[expected1 expected2]
|
||||
!> (parse:parse(default-database 'dummy') " \0atrUncate TAble\0d ~zod.db.ns.name\0a; truncate table ~sampel-palnet.db..name")
|
||||
::
|
||||
:: name, as of date
|
||||
++ test-drop-namespace-04
|
||||
:: leading and trailing whitespace characters, end delimiter not required on single, db.ns.name
|
||||
++ test-truncate-table-2
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of ~2023.12.25..7.15.0..1ef5")
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='db' namespace='ns' name='name'] ~]]
|
||||
!> (parse:parse(default-database 'dummy') " \09truncate\0d\09 TaBle\0a db.ns.name ")
|
||||
::
|
||||
:: name, as of 5 seconds ago
|
||||
++ test-drop-namespace-05
|
||||
:: db..name
|
||||
++ test-truncate-table-3
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.n as-of=[~ [%as-of-offset 5 %seconds]]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace ns1 as of 5 seconds ago")
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='db' namespace='dbo' name='name'] ~]]
|
||||
!> (parse:parse(default-database 'dummy') "truncate table db..name")
|
||||
::
|
||||
:: force name as of now
|
||||
++ test-drop-namespace-06
|
||||
:: ns.name
|
||||
++ test-truncate-table-4
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=~]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of now")
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='dummy' namespace='ns' name='name'] ~]]
|
||||
!> (parse:parse(default-database 'dummy') "truncate table ns.name")
|
||||
::
|
||||
:: force name as of date
|
||||
++ test-drop-namespace-07
|
||||
:: name
|
||||
++ test-truncate-table-5
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of ~2023.12.25..7.15.0..1ef5")
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='dummy' namespace='dbo' name='name'] ~]]
|
||||
!> (parse:parse(default-database 'dummy') "truncate table name")
|
||||
::
|
||||
:: force name as of 5 seconds ago
|
||||
++ test-drop-namespace-08
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='other-db' name='ns1' force=%.y as-of=[~ [%as-of-offset 5 %seconds]]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace force ns1 as of 5 seconds ago")
|
||||
:: fail when database qualifier is not a term
|
||||
++ test-fail-truncate-table-6
|
||||
%- expect-fail
|
||||
|. (parse:parse(default-database 'dummy') "truncate table Db.ns.name")
|
||||
::
|
||||
:: db name as of now
|
||||
++ test-drop-namespace-09
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=~]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of now")
|
||||
:: fail when namespace qualifier is not a term
|
||||
++ test-fail-truncate-table-7
|
||||
%- expect-fail
|
||||
|. (parse:parse(default-database 'dummy') "truncate table db.nS.name")
|
||||
::
|
||||
:: db name as of date
|
||||
++ test-drop-namespace-10
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of ~2023.12.25..7.15.0..1ef5")
|
||||
:: fail when view name is not a term
|
||||
++ test-fail-truncate-table-8
|
||||
%- expect-fail
|
||||
|. (parse:parse(default-database 'dummy') "truncate table db.ns.nAme")
|
||||
::
|
||||
:: db name as of 5 seconds ago
|
||||
++ test-drop-namespace-11
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.n as-of=[~ [%as-of-offset 5 %seconds]]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace db1.ns1 as of 5 seconds ago")
|
||||
:: fail when view name is not a term
|
||||
++ test-fail-truncate-table-9
|
||||
%- expect-fail
|
||||
|. (parse:parse(default-database 'dummy') "truncate table db.ns.nAme")
|
||||
::
|
||||
:: force db name as of
|
||||
++ test-drop-namespace-12
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=~]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of now")
|
||||
::
|
||||
:: force db name as of
|
||||
++ test-drop-namespace-13
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of ~2023.12.25..7.15.0..1ef5")
|
||||
::
|
||||
:: force db name as of
|
||||
++ test-drop-namespace-14
|
||||
%+ expect-eq
|
||||
!> ~[[%drop-namespace database-name='db1' name='ns1' force=%.y as-of=[~ [%as-of-offset 15 %minutes]]]]
|
||||
!> (parse:parse(default-database 'other-db') "drop namespace force db1.ns1 as of 15 minutes ago")
|
||||
|
||||
:: fail when ship is invalid
|
||||
++ test-fail-truncate-table-10
|
||||
%- expect-fail
|
||||
|. (parse:parse(default-database 'dummy') "truncate table ~shitty-shippp db.ns.nAme")
|
||||
|
||||
|
||||
::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
@ -563,43 +563,43 @@
|
||||
::
|
||||
:: delete from foo;delete foo
|
||||
++ test-delete-01
|
||||
=/ expected1 [%transform ctes=~ [[%delete table=foo-table ~] ~ ~]]
|
||||
=/ expected2 [%transform ctes=~ [[%delete table=foo-table ~] ~ ~]]
|
||||
=/ expected1 [%transform ctes=~ [[%delete table=foo-table ~ ~] ~ ~]]
|
||||
=/ expected2 [%transform ctes=~ [[%delete table=foo-table ~ ~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected1 expected2]
|
||||
!> (parse:parse(default-database 'db1') "delete from foo;delete foo")
|
||||
::
|
||||
:: delete with predicate
|
||||
++ test-delete-02
|
||||
=/ expected [%transform ctes=~ [[%delete table=foo-table delete-pred] ~ ~]]
|
||||
=/ expected [%transform ctes=~ [[%delete table=foo-table delete-pred ~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') "delete from foo where foo=bar")
|
||||
::
|
||||
:: delete with one cte and predicate
|
||||
++ test-delete-03
|
||||
=/ expected [%transform ctes=~[cte-t1] [[%delete table=foo-table delete-pred] ~ ~]]
|
||||
=/ expected [%transform ctes=~[cte-t1] [[%delete table=foo-table delete-pred ~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') "with (select *) as t1 delete from foo where foo=bar")
|
||||
::
|
||||
:: delete with two ctes and predicate
|
||||
++ test-delete-04
|
||||
=/ expected [%transform ctes=~[cte-t1 cte-foobar] [[%delete table=foo-table delete-pred] ~ ~]]
|
||||
=/ expected [%transform ctes=~[cte-t1 cte-foobar] [[%delete table=foo-table delete-pred ~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') "with (select *) as t1, (from foobar where col1=2 select col3, col4) as foobar delete from foo where foo=bar")
|
||||
::
|
||||
:: delete with three ctes and predicate
|
||||
++ test-delete-05
|
||||
=/ expected [%transform ctes=~[cte-t1 cte-foobar cte-bar] [%delete table=foo-table delete-pred] ~ ~]
|
||||
=/ expected [%transform ctes=~[cte-t1 cte-foobar cte-bar] [%delete table=foo-table delete-pred ~] ~ ~]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') "with (select *) as t1, (from foobar where col1=2 select col3, col4) as foobar, (from bar where col1=col2 select col2) as bar delete from foo where foo=bar")
|
||||
::
|
||||
:: delete cte with no predicate
|
||||
++ test-delete-06
|
||||
=/ expected [%transform ctes=~[cte-t1] [[%delete table=foo-table ~] ~ ~]]
|
||||
=/ expected [%transform ctes=~[cte-t1] [[%delete table=foo-table ~ ~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') "with (select *) as t1 delete from foo")
|
||||
@ -1025,9 +1025,9 @@
|
||||
:: 3) enforce consistent value counts across rows
|
||||
++ test-insert-1
|
||||
=/ expected1
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~] values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]] ~ ~]]
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~] values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]] ~] ~ ~]]
|
||||
=/ expected2
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='dbo' name='my-table'] columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~] values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]]]]] ~ ~]]
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='dbo' name='my-table'] columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~] values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]]]] ~] ~ ~]]
|
||||
=/ urql1 " iNsert iNto db.ns.my-table ".
|
||||
"( col1 , col2 , col3 , col4 , col5 , col6 , col7 , col8 , col9 )".
|
||||
" Values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
|
||||
@ -1042,7 +1042,7 @@
|
||||
:: table, no columns, 3 rows
|
||||
++ test-insert-2
|
||||
=/ expected
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table'] columns=~ values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]] ~ ~]]
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table'] columns=~ values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]] ~] ~ ~]]
|
||||
=/ urql "insert into my-table ".
|
||||
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
|
||||
" (default,.195.198.143.90, 195.198.143.900)".
|
||||
@ -1054,7 +1054,7 @@
|
||||
:: every column type, no spaces around values
|
||||
++ test-insert-3
|
||||
=/ expected
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=~ values=[%data ~[~[[~.t 1.685.221.219] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]] ~ ~]]
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=~ values=[%data ~[~[[~.t 1.685.221.219] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]] ~] ~ ~]]
|
||||
=/ urql "insert into db.ns.my-table ".
|
||||
"values ('cord',~nomryg-nilref,nomryg-nilref,~2020.12.25..7.15.0..1ef5,2020.12.25..7.15.0..1ef5,".
|
||||
"~d71.h19.m26.s24..9d55, d71.h19.m26.s24..9d55,.195.198.143.90,.0.0.0.0.0.1c.c3c6.8f5a,y,n,Y,N,".
|
||||
@ -1066,7 +1066,7 @@
|
||||
:: every column type, spaces on all sides of values, comma inside cord
|
||||
++ test-insert-4
|
||||
=/ expected
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=~ values=[%data ~[~[[~.t 430.242.426.723] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]] ~ ~]]
|
||||
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=~ values=[%data ~[~[[~.t 430.242.426.723] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]] ~] ~ ~]]
|
||||
=/ urql "insert into db.ns.my-table ".
|
||||
"values ( 'cor,d' , ~nomryg-nilref , nomryg-nilref , ~2020.12.25..7.15.0..1ef5 , 2020.12.25..7.15.0..1ef5 , ".
|
||||
"~d71.h19.m26.s24..9d55 , d71.h19.m26.s24..9d55 , .195.198.143.90 , .0.0.0.0.0.1c.c3c6.8f5a , y , n , Y , N , ".
|
||||
@ -1194,8 +1194,8 @@
|
||||
::
|
||||
:: tests 1, 2, 3, 5, and extra whitespace characters
|
||||
++ test-truncate-table-1
|
||||
=/ expected1 [%truncate-table table=[%qualified-object ship=[~ ~zod] database='db' namespace='ns' name='name']]
|
||||
=/ expected2 [%truncate-table table=[%qualified-object ship=[~ ~sampel-palnet] database='db' namespace='dbo' name='name']]
|
||||
=/ expected1 [%truncate-table table=[%qualified-object ship=[~ ~zod] database='db' namespace='ns' name='name'] as-of=~]
|
||||
=/ expected2 [%truncate-table table=[%qualified-object ship=[~ ~sampel-palnet] database='db' namespace='dbo' name='name'] as-of=~]
|
||||
%+ expect-eq
|
||||
!> ~[expected1 expected2]
|
||||
!> (parse:parse(default-database 'dummy') " \0atrUncate TAble\0d ~zod.db.ns.name\0a; truncate table ~sampel-palnet.db..name")
|
||||
@ -1203,25 +1203,25 @@
|
||||
:: leading and trailing whitespace characters, end delimiter not required on single, db.ns.name
|
||||
++ test-truncate-table-2
|
||||
%+ expect-eq
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='db' namespace='ns' name='name']]]
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='db' namespace='ns' name='name'] as-of=~]]
|
||||
!> (parse:parse(default-database 'dummy') " \09truncate\0d\09 TaBle\0a db.ns.name ")
|
||||
::
|
||||
:: db..name
|
||||
++ test-truncate-table-3
|
||||
%+ expect-eq
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='db' namespace='dbo' name='name']]]
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='db' namespace='dbo' name='name'] as-of=~]]
|
||||
!> (parse:parse(default-database 'dummy') "truncate table db..name")
|
||||
::
|
||||
:: ns.name
|
||||
++ test-truncate-table-4
|
||||
%+ expect-eq
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='dummy' namespace='ns' name='name']]]
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='dummy' namespace='ns' name='name'] as-of=~]]
|
||||
!> (parse:parse(default-database 'dummy') "truncate table ns.name")
|
||||
::
|
||||
:: name
|
||||
++ test-truncate-table-5
|
||||
%+ expect-eq
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='dummy' namespace='dbo' name='name']]]
|
||||
!> ~[[%truncate-table table=[%qualified-object ship=~ database='dummy' namespace='dbo' name='name'] as-of=~]]
|
||||
!> (parse:parse(default-database 'dummy') "truncate table name")
|
||||
::
|
||||
:: fail when database qualifier is not a term
|
||||
@ -2447,32 +2447,32 @@
|
||||
:: update one column, no predicate
|
||||
++ test-update-01
|
||||
%+ expect-eq
|
||||
!> ~[[%transform ctes=~ [[%update table=foo-table columns=~['col1'] values=~[[value-type=%t value='hello']] predicate=~] ~ ~]]]
|
||||
!> ~[[%transform ctes=~ [[%update table=foo-table columns=~['col1'] values=~[[value-type=%t value='hello']] predicate=~ as-of=~] ~ ~]]]
|
||||
!> (parse:parse(default-database 'db1') "update foo set col1='hello'")
|
||||
::
|
||||
:: update two columns, no predicate
|
||||
++ test-update-02
|
||||
%+ expect-eq
|
||||
!> ~[[%transform ctes=~ [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=~] ~ ~]]]
|
||||
!> ~[[%transform ctes=~ [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=~ as-of=~] ~ ~]]]
|
||||
!> (parse:parse(default-database 'db1') "update foo set col1=col2, col3 = 'hello'")
|
||||
::
|
||||
:: update two columns, with predicate
|
||||
++ test-update-03
|
||||
%+ expect-eq
|
||||
!> ~[[%transform ctes=~ [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=`update-pred] ~ ~]]]
|
||||
!> ~[[%transform ctes=~ [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=`update-pred as-of=~] ~ ~]]]
|
||||
!> (parse:parse(default-database 'db1') "update foo set col1=col2, col3 = 'hello' where 1 = 1 and col2 = 4")
|
||||
|
||||
::
|
||||
:: update with one cte and predicate
|
||||
++ test-update-04
|
||||
%+ expect-eq
|
||||
!> ~[[%transform ctes=~[cte-t1] [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=`update-pred] ~ ~]]]
|
||||
!> ~[[%transform ctes=~[cte-t1] [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=`update-pred as-of=~] ~ ~]]]
|
||||
!> (parse:parse(default-database 'db1') "with (select *) as t1 update foo set col1=col2, col3 = 'hello' where 1 = 1 and col2 = 4")
|
||||
::
|
||||
:: update with three ctes and predicate
|
||||
++ test-update-05
|
||||
%+ expect-eq
|
||||
!> ~[[%transform ctes=~[cte-t1 cte-foobar cte-bar] [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=`update-pred] ~ ~]]]
|
||||
!> ~[[%transform ctes=~[cte-t1 cte-foobar cte-bar] [[%update table=foo-table columns=~['col3' 'col1'] values=~[[value-type=%t value='hello'] col2] predicate=`update-pred as-of=~] ~ ~]]]
|
||||
!> (parse:parse(default-database 'db1') "with (select *) as t1, (from foobar where col1=2 select col3, col4) as foobar, (from bar where col1=col2 select col2) as bar update foo set col1=col2, col3 = 'hello' where 1 = 1 and col2 = 4")
|
||||
::
|
||||
:: fail update cte with no predicate
|
||||
@ -2508,7 +2508,7 @@
|
||||
" WHEN MATCHED THEN ".
|
||||
" UPDATE SET foobar = src.foo "
|
||||
=/ expected
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=[~ 'tgt']] new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=[~ 'tgt']] new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2523,7 +2523,7 @@
|
||||
" UPDATE SET foobar = src.foo, ".
|
||||
" bar = bar "
|
||||
=/ expected
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=[~ 'tgt']] new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo] ['bar' column-bar]]]]] unmatched-by-target=~ unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=[~ 'tgt']] new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo] ['bar' column-bar]]]]] unmatched-by-target=~ unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2540,7 +2540,7 @@
|
||||
" INSERT (bar, foobar) ".
|
||||
" VALUES (src.bar, 99)"
|
||||
=/ expected
|
||||
[%transform ctes=~[cte-bar-foobar-src] [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='src'] alias=~] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~[cte-bar-foobar-src] [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='src'] alias=~] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2554,7 +2554,7 @@
|
||||
" WHEN MATCHED THEN ".
|
||||
" UPDATE SET foobar = src.foo "
|
||||
=/ expected
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=passthru-tgt new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=passthru-tgt new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2568,7 +2568,7 @@
|
||||
" WHEN MATCHED THEN ".
|
||||
" UPDATE SET foobar = src.foo "
|
||||
=/ expected
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=passthru-tgt new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=passthru-tgt new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2582,7 +2582,7 @@
|
||||
" WHEN MATCHED THEN ".
|
||||
" UPDATE SET foobar = src.foo "
|
||||
=/ expected
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=passthru-unaliased new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~[cte-bar-foobar] [[%merge target-table=passthru-unaliased new-table=~ source-table=[%table-set object=[%qualified-object ship=~ database='UNKNOWN' namespace='COLUMN-OR-CTE' name='T1'] alias=[~ 'src']] predicate=predicate-bar-eq-bar matched=~[[%matching predicate=~ matching-profile=[%update ~[['foobar' column-src-foo]]]]] unmatched-by-target=~ unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2598,7 +2598,7 @@
|
||||
" INSERT (bar, foobar) ".
|
||||
" VALUES (src.bar, 99)"
|
||||
=/ expected
|
||||
[%transform ctes=~ [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=passthru-src predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~ [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=passthru-src predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2614,7 +2614,7 @@
|
||||
" INSERT (bar, foobar) ".
|
||||
" VALUES (src.bar, 99)"
|
||||
=/ expected
|
||||
[%transform ctes=~ [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=passthru-src predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~ [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=passthru-src predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
@ -2630,7 +2630,7 @@
|
||||
" INSERT (bar, foobar) ".
|
||||
" VALUES (src.bar, 99)"
|
||||
=/ expected
|
||||
[%transform ctes=~ [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=passthru-unaliased predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~] ~ ~]]
|
||||
[%transform ctes=~ [[%merge target-table=[%table-set object=[%qualified-object ship=~ database='db1' namespace='dbo' name='foo'] alias=~] new-table=~ source-table=passthru-unaliased predicate=predicate-bar-eq-bar matched=~[[%matching predicate=`one-eq-1 matching-profile=[%update ~[['foobar' column-src-foobar]]]]] unmatched-by-target=~[[%matching predicate=~ matching-profile=[%insert ~[['bar' column-src-bar] ['foobar' [value-type=%ud value=99]]]]]] unmatched-by-source=~ as-of=~] ~ ~]]
|
||||
%+ expect-eq
|
||||
!> ~[expected]
|
||||
!> (parse:parse(default-database 'db1') query)
|
||||
|
Loading…
Reference in New Issue
Block a user