khfaraaz82@gmail.com | 6621b1d | 2012-05-25 07:26:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Testcase Name : c2c-wo-optional.aql |
| 3 | * Description : Insert data into target datase by doing a select on source dataset. |
| 4 | * : Here both source and target datasets are internal datasets |
| 5 | * : The schema includes one optional field named optnl_fld. |
| 6 | * : Note that the optional field in source dataset does not hold any data. |
| 7 | * Success : Yes |
| 8 | * Date : 23rd May 2012 |
| 9 | */ |
| 10 | |
| 11 | drop dataverse test if exists; |
| 12 | create dataverse test; |
| 13 | use dataverse test; |
| 14 | |
| 15 | create type TestType as closed { |
| 16 | id:int32, |
| 17 | description:string, |
| 18 | name:string, |
| 19 | optnl_fld:string? |
| 20 | } |
| 21 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame^] | 22 | create dataset T1(TestType) primary key id; |
khfaraaz82@gmail.com | 6621b1d | 2012-05-25 07:26:35 +0000 | [diff] [blame] | 23 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame^] | 24 | create dataset T2(TestType) primary key id; |
khfaraaz82@gmail.com | 6621b1d | 2012-05-25 07:26:35 +0000 | [diff] [blame] | 25 | |
| 26 | insert into dataset T1({ |
| 27 | "id":1234, |
| 28 | "description":"donut", |
| 29 | "name":"Cake" |
| 30 | } |
| 31 | ); |
| 32 | |
| 33 | insert into dataset T2(for $l in dataset("T1") return $l ); |
| 34 | |
| 35 | for $d in dataset("T2") |
| 36 | order by $d.id |
| 37 | return $d |