@@ -1396,6 +1396,45 @@ var GeneratedColumnTests = []ScriptTest{
1396
1396
},
1397
1397
},
1398
1398
},
1399
+ {
1400
+ // https://github.com/dolthub/dolt/issues/8968
1401
+ Name : "can select all columns from table with generated column" ,
1402
+ SetUpScript : []string {
1403
+ "create table t(pk int primary key, j1 json)" ,
1404
+ `insert into t values (1, '{"name": "foo"}')` ,
1405
+ "alter table t add column g1 varchar(100) generated always as (json_unquote(json_extract(`j1`, '$.name')))" ,
1406
+ },
1407
+ Assertions : []ScriptTestAssertion {
1408
+ {
1409
+ Query : "select * from t" ,
1410
+ Expected : []sql.Row {{1 , `{"name":"foo"}` , "foo" }},
1411
+ },
1412
+ {
1413
+ Query : "select pk, j1, g1 from t" ,
1414
+ Expected : []sql.Row {{1 , `{"name":"foo"}` , "foo" }},
1415
+ },
1416
+ {
1417
+ Query : "select pk, g1 from t" ,
1418
+ Expected : []sql.Row {{1 , "foo" }},
1419
+ },
1420
+ {
1421
+ Query : "select g1 from t" ,
1422
+ Expected : []sql.Row {{"foo" }},
1423
+ },
1424
+ {
1425
+ Query : "select j1, g1 from t" ,
1426
+ Expected : []sql.Row {{`{"name":"foo"}` , "foo" }},
1427
+ },
1428
+ {
1429
+ Query : "select j1 from t" ,
1430
+ Expected : []sql.Row {{`{"name":"foo"}` }},
1431
+ },
1432
+ {
1433
+ Query : "select pk, j1 from t" ,
1434
+ Expected : []sql.Row {{1 , `{"name":"foo"}` }},
1435
+ },
1436
+ },
1437
+ },
1399
1438
}
1400
1439
1401
1440
var BrokenGeneratedColumnTests = []ScriptTest {
0 commit comments