diff --git a/go/test/endtoend/vtgate/vitess_tester/aggregation/aggregation.test b/go/test/endtoend/vtgate/vitess_tester/aggregation/aggregation.test index 1f4cd2fe4f0..d675b341616 100644 --- a/go/test/endtoend/vtgate/vitess_tester/aggregation/aggregation.test +++ b/go/test/endtoend/vtgate/vitess_tester/aggregation/aggregation.test @@ -68,3 +68,6 @@ from (select name from t1 group by name having count(t1.id) > 1) t1; # this query uses last_insert_id with a column argument to show that this works well select id, last_insert_id(count(*)) as num_segments from t1 group by id; + +# checking that we stored the correct value in the last_insert_id +select last_insert_id(); \ No newline at end of file diff --git a/go/vt/vtgate/planbuilder/testdata/select_cases.json b/go/vt/vtgate/planbuilder/testdata/select_cases.json index 9a2f596ff6c..d10638630ab 100644 --- a/go/vt/vtgate/planbuilder/testdata/select_cases.json +++ b/go/vt/vtgate/planbuilder/testdata/select_cases.json @@ -2190,10 +2190,10 @@ }, { "comment": "save column value to session - sharded", - "query": "select bar, 12, last_insert_id(foo) from user", + "query": "select col, 12, last_insert_id(intcol) from user", "plan": { "QueryType": "SELECT", - "Original": "select bar, 12, last_insert_id(foo) from user", + "Original": "select col, 12, last_insert_id(intcol) from user", "Instructions": { "OperatorType": "SaveToSession", "Offset": "_vt_column_2", @@ -2205,8 +2205,8 @@ "Name": "user", "Sharded": true }, - "FieldQuery": "select bar, 12, last_insert_id(foo) from `user` where 1 != 1", - "Query": "select bar, 12, last_insert_id(foo) from `user`", + "FieldQuery": "select col, 12, last_insert_id(intcol) from `user` where 1 != 1", + "Query": "select col, 12, last_insert_id(intcol) from `user`", "Table": "`user`" } ] @@ -2218,10 +2218,10 @@ }, { "comment": "save column value to session - unsharded", - "query": "select bar, 12, last_insert_id(foo) from unsharded", + "query": "select col1, 12, last_insert_id(id) from unsharded", "plan": { "QueryType": "SELECT", - "Original": "select bar, 12, last_insert_id(foo) from unsharded", + "Original": "select col1, 12, last_insert_id(id) from unsharded", "Instructions": { "OperatorType": "SaveToSession", "Offset": "_vt_column_2", @@ -2233,8 +2233,8 @@ "Name": "main", "Sharded": false }, - "FieldQuery": "select bar, 12, last_insert_id(foo) from unsharded where 1 != 1", - "Query": "select bar, 12, last_insert_id(foo) from unsharded", + "FieldQuery": "select col1, 12, last_insert_id(id) from unsharded where 1 != 1", + "Query": "select col1, 12, last_insert_id(id) from unsharded", "Table": "unsharded" } ]