diff --git a/data/test/sqlparser_test/exec_cases.txt b/data/test/sqlparser_test/exec_cases.txt index 7a59725451..0e19b194e6 100644 --- a/data/test/sqlparser_test/exec_cases.txt +++ b/data/test/sqlparser_test/exec_cases.txt @@ -1516,6 +1516,29 @@ update b set eid=1 "SetValue": null } +# pk changed as qualified column name +update b set a.eid=1 +{ + "PlanId": "DML_SUBQUERY", + "Reason": "WHERE", + "TableName": "b", + "DisplayQuery": "update b set a.eid = ?", + "FieldQuery": null, + "FullQuery": "update b set a.eid = 1", + "OuterQuery": "update b set a.eid = 1 where eid = :0 and id = :1", + "Subquery": "select eid, id from b limit :_vtMaxResultSize for update", + "IndexUsed": "", + "ColumnNumbers": null, + "PKValues": null, + "SecondaryPKValues": [ + 1, + null + ], + "SubqueryPKColumns": null, + "SetKey": "", + "SetValue": null +} + # complex pk change update b set eid=foo() { @@ -1599,6 +1622,29 @@ update a set name='foo' where eid=1 and id=1 "SetValue": null } +# update with qualified column name +update a set a.name='foo' where eid=1 and id=1 +{ + "PlanId": "DML_PK", + "Reason": "DEFAULT", + "TableName": "a", + "DisplayQuery": "update a set a.name = ? where eid = ? and id = ?", + "FieldQuery": null, + "FullQuery": "update a set a.name = 'foo' where eid = 1 and id = 1", + "OuterQuery": "update a set a.name = 'foo' where eid = 1 and id = 1", + "Subquery": "select eid, id from a where eid = 1 and id = 1 limit :_vtMaxResultSize for update", + "IndexUsed": "", + "ColumnNumbers": null, + "PKValues": [ + 1, + 1 + ], + "SecondaryPKValues": null, + "SubqueryPKColumns": null, + "SetKey": "", + "SetValue": null +} + # partial pk update a set name='foo' where eid=1 { diff --git a/data/test/sqlparser_test/parse_pass.sql b/data/test/sqlparser_test/parse_pass.sql index c7fb778fd8..76e6ae6fb5 100644 --- a/data/test/sqlparser_test/parse_pass.sql +++ b/data/test/sqlparser_test/parse_pass.sql @@ -123,6 +123,7 @@ insert /* select */ into a select b, c from d insert /* on duplicate */ into a values (1, 2) on duplicate key update b = values(a), c = d update /* simple */ a set b = 3 update /* a.b */ a.b set b = 3 +update /* b.c */ a set b.c = 3 update /* list */ a set b = 3, c = 4 update /* expression */ a set b = 3+4 update /* where */ a set b = 3 where a = b diff --git a/go/vt/sqlparser/execution.go b/go/vt/sqlparser/execution.go index 76d1e41bc8..d6c7f9da11 100644 --- a/go/vt/sqlparser/execution.go +++ b/go/vt/sqlparser/execution.go @@ -730,7 +730,7 @@ func (node *Node) parseList() (values interface{}, isList bool) { func (node *Node) execAnalyzeUpdateExpressions(pkIndex *schema.Index) (pkValues []interface{}, ok bool) { for i := 0; i < node.Len(); i++ { - columnName := string(node.At(i).At(0).Value) + columnName := string(node.At(i).At(0).execAnalyzeSelectExpression()) index := pkIndex.FindColumn(columnName) if index == -1 { continue diff --git a/go/vt/sqlparser/sql.go b/go/vt/sqlparser/sql.go index 43fc68d9ec..0c5c3f1525 100644 --- a/go/vt/sqlparser/sql.go +++ b/go/vt/sqlparser/sql.go @@ -292,10 +292,10 @@ var yyExca = []int{ -1, 1, 1, -1, -2, 0, - -1, 64, + -1, 66, 35, 43, -2, 38, - -1, 172, + -1, 175, 35, 43, -2, 66, } @@ -306,113 +306,115 @@ const yyPrivate = 57344 var yyTokenNames []string var yyStates []string -const yyLast = 549 +const yyLast = 562 var yyAct = []int{ - 74, 67, 49, 302, 326, 268, 221, 136, 181, 242, - 170, 156, 72, 145, 143, 105, 159, 66, 334, 64, - 334, 135, 3, 104, 152, 62, 32, 61, 108, 109, - 201, 34, 51, 266, 22, 23, 24, 25, 59, 104, - 60, 104, 201, 40, 50, 54, 36, 22, 23, 24, - 25, 22, 23, 24, 25, 228, 97, 99, 38, 39, - 288, 287, 55, 22, 23, 24, 25, 260, 56, 37, - 246, 132, 137, 198, 146, 138, 147, 259, 199, 206, - 335, 77, 333, 107, 91, 294, 81, 131, 134, 86, - 96, 51, 290, 150, 51, 265, 65, 78, 79, 80, - 291, 257, 52, 255, 202, 70, 175, 144, 177, 84, - 132, 132, 180, 285, 155, 186, 187, 258, 190, 191, - 192, 193, 194, 195, 196, 197, 178, 179, 69, 200, - 174, 310, 82, 83, 63, 146, 106, 147, 154, 87, - 176, 203, 146, 188, 147, 209, 121, 122, 123, 308, - 219, 262, 85, 108, 109, 132, 224, 210, 165, 211, - 225, 102, 218, 309, 208, 283, 212, 213, 205, 207, - 216, 223, 226, 320, 321, 220, 204, 282, 163, 244, - 245, 166, 239, 281, 203, 189, 250, 251, 243, 153, - 247, 93, 249, 240, 229, 244, 245, 279, 103, 177, - 153, 201, 280, 254, 248, 232, 233, 234, 235, 236, - 318, 237, 238, 297, 182, 116, 117, 118, 119, 120, - 121, 122, 123, 277, 264, 210, 94, 267, 278, 46, - 162, 164, 161, 230, 256, 119, 120, 121, 122, 123, - 77, 275, 276, 104, 93, 81, 12, 313, 86, 22, - 23, 24, 25, 173, 293, 133, 78, 79, 80, 312, - 173, 149, 241, 240, 70, 142, 284, 219, 84, 171, - 141, 300, 303, 299, 140, 89, 52, 173, 92, 298, - 295, 133, 338, 304, 289, 286, 241, 69, 272, 271, - 168, 82, 83, 167, 314, 151, 311, 100, 87, 146, - 339, 147, 98, 95, 47, 57, 316, 90, 132, 203, - 132, 85, 322, 327, 327, 324, 315, 296, 328, 330, - 303, 45, 331, 253, 323, 342, 325, 12, 332, 12, - 51, 77, 336, 157, 101, 340, 81, 106, 183, 86, - 184, 185, 43, 343, 344, 77, 65, 78, 79, 80, - 81, 215, 41, 86, 88, 70, 269, 307, 270, 84, - 133, 78, 79, 80, 222, 12, 13, 14, 15, 70, - 306, 48, 274, 84, 153, 27, 12, 341, 69, 329, - 158, 33, 82, 83, 63, 227, 160, 35, 12, 87, - 77, 53, 69, 58, 16, 81, 82, 83, 86, 217, - 148, 261, 85, 87, 337, 133, 78, 79, 80, 81, - 319, 301, 86, 305, 70, 273, 85, 71, 84, 133, - 78, 79, 80, 232, 233, 234, 235, 236, 139, 237, - 238, 76, 84, 73, 75, 263, 214, 69, 110, 68, - 81, 82, 83, 86, 17, 18, 20, 19, 87, 172, - 133, 78, 79, 80, 26, 82, 83, 231, 169, 139, - 42, 85, 87, 84, 111, 115, 113, 114, 28, 29, - 30, 31, 21, 44, 11, 85, 10, 9, 8, 317, - 7, 6, 127, 128, 129, 130, 82, 83, 124, 125, - 126, 5, 4, 87, 116, 117, 118, 119, 120, 121, - 122, 123, 2, 1, 0, 0, 85, 0, 0, 0, - 112, 116, 117, 118, 119, 120, 121, 122, 123, 292, - 0, 0, 116, 117, 118, 119, 120, 121, 122, 123, - 252, 0, 0, 116, 117, 118, 119, 120, 121, 122, - 123, 116, 117, 118, 119, 120, 121, 122, 123, + 76, 69, 49, 302, 326, 221, 74, 138, 268, 242, + 159, 63, 173, 145, 183, 147, 334, 68, 108, 334, + 66, 137, 3, 107, 154, 111, 112, 232, 233, 234, + 235, 236, 52, 237, 238, 202, 64, 50, 51, 266, + 61, 107, 107, 40, 202, 162, 22, 23, 24, 25, + 22, 23, 24, 25, 57, 60, 55, 100, 12, 13, + 14, 15, 36, 228, 102, 22, 23, 24, 25, 22, + 23, 24, 25, 135, 139, 200, 260, 140, 335, 32, + 37, 333, 38, 39, 34, 294, 288, 16, 284, 134, + 136, 287, 56, 52, 246, 152, 52, 290, 158, 51, + 110, 265, 51, 257, 255, 148, 203, 149, 259, 178, + 146, 158, 291, 135, 135, 182, 285, 157, 188, 189, + 97, 192, 193, 194, 195, 196, 197, 198, 199, 180, + 181, 258, 148, 156, 149, 201, 93, 17, 18, 20, + 19, 99, 168, 204, 177, 148, 62, 149, 210, 124, + 125, 126, 52, 190, 206, 208, 308, 135, 219, 262, + 212, 211, 166, 225, 109, 169, 209, 111, 112, 213, + 214, 224, 217, 223, 226, 244, 245, 220, 12, 122, + 123, 124, 125, 126, 179, 105, 204, 239, 250, 251, + 310, 309, 247, 279, 243, 191, 240, 229, 280, 83, + 249, 283, 88, 282, 254, 281, 248, 244, 245, 53, + 80, 81, 82, 155, 165, 167, 164, 155, 141, 256, + 277, 106, 86, 95, 202, 278, 267, 96, 211, 318, + 207, 264, 79, 22, 23, 24, 25, 83, 297, 184, + 88, 313, 46, 275, 276, 84, 85, 67, 80, 81, + 82, 312, 89, 176, 293, 12, 72, 230, 151, 176, + 86, 95, 241, 240, 144, 87, 107, 52, 174, 143, + 142, 300, 303, 298, 62, 338, 299, 53, 289, 71, + 286, 295, 304, 84, 85, 65, 176, 272, 91, 271, + 89, 94, 171, 339, 314, 241, 311, 170, 232, 233, + 234, 235, 236, 87, 237, 238, 153, 103, 135, 204, + 135, 322, 316, 327, 327, 324, 101, 98, 328, 330, + 303, 47, 331, 58, 323, 92, 325, 205, 315, 296, + 52, 332, 336, 79, 12, 340, 51, 45, 83, 253, + 342, 88, 160, 343, 344, 104, 109, 43, 53, 80, + 81, 82, 41, 185, 79, 186, 187, 72, 216, 83, + 26, 86, 88, 90, 269, 307, 270, 222, 306, 67, + 80, 81, 82, 274, 28, 29, 30, 31, 72, 155, + 71, 48, 86, 341, 84, 85, 329, 12, 12, 27, + 161, 89, 148, 33, 149, 227, 163, 35, 54, 59, + 218, 71, 150, 79, 87, 84, 85, 65, 83, 261, + 337, 88, 89, 319, 301, 305, 273, 73, 53, 80, + 81, 82, 78, 75, 79, 87, 77, 72, 263, 83, + 215, 86, 88, 113, 83, 70, 175, 88, 231, 53, + 80, 81, 82, 172, 53, 80, 81, 82, 72, 42, + 71, 21, 86, 141, 84, 85, 44, 86, 11, 320, + 321, 89, 10, 9, 8, 114, 118, 116, 117, 7, + 6, 71, 5, 4, 87, 84, 85, 2, 1, 0, + 84, 85, 89, 130, 131, 132, 133, 89, 0, 127, + 128, 129, 0, 0, 0, 87, 0, 0, 0, 0, + 87, 119, 120, 121, 122, 123, 124, 125, 126, 317, + 0, 115, 119, 120, 121, 122, 123, 124, 125, 126, + 0, 0, 0, 0, 119, 120, 121, 122, 123, 124, + 125, 126, 292, 0, 0, 119, 120, 121, 122, 123, + 124, 125, 126, 252, 0, 0, 119, 120, 121, 122, + 123, 124, 125, 126, 119, 120, 121, 122, 123, 124, + 125, 126, } var yyPact = []int{ - 361, -1000, -1000, 200, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, -1000, -1000, -61, -44, -18, - -29, 372, 335, -1000, -1000, -1000, 324, -1000, 292, 269, - 363, 241, -46, -26, -1000, -19, -1000, 270, -53, 241, - -1000, -1000, 311, -1000, 339, 269, 274, 8, 269, 138, - -1000, 181, -1000, 268, 23, 241, 267, -32, 262, 314, - 97, 190, -1000, -1000, 318, 7, 88, 443, -1000, 370, - 325, -1000, -1000, 415, 230, 226, -1000, 221, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, -1000, -1000, 220, -1000, 217, - 241, 260, 365, 241, 370, -1000, 313, -77, 146, 258, - -1000, -1000, 255, 225, 311, 241, -1000, 67, 370, 370, - 415, 170, 317, 415, 415, 118, 415, 415, 415, 415, - 415, 415, 415, 415, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 443, -3, -37, 14, -11, 443, -1000, 384, - 61, 311, 372, 63, 56, -1000, 370, 370, 323, 246, - 191, -1000, 352, 370, -1000, -1000, -1000, -1000, 92, 241, - -1000, -34, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 180, - 369, 242, 117, -6, -1000, -1000, -1000, -1000, -1000, -1000, - 473, -1000, 384, 170, 415, 415, 473, 465, -1000, 298, - 164, 164, 164, 73, 73, -1000, -1000, -1000, 241, -1000, - -1000, 415, -1000, 473, -1000, -12, 311, -14, 2, -1000, - -1000, -5, -13, -1000, 87, 170, 200, -20, -1000, -1000, - 352, 342, 345, 88, 254, -1000, -1000, 253, -1000, 362, - 218, 218, -1000, -1000, 169, 143, 129, 123, 111, 151, - -2, 372, -1000, 250, -27, -28, 249, -23, -15, -1000, - 473, 454, 415, -1000, 473, -1000, -30, -1000, -1000, -1000, - 370, -1000, 287, 160, -1000, -1000, 246, 342, -1000, 415, - 415, -1000, -1000, 359, 344, 369, 85, -1000, 109, -1000, - 77, -1000, -1000, -1000, -1000, -1000, 133, 215, 203, -1000, - -1000, -1000, 415, 473, -1000, -1000, 285, 170, -1000, -1000, - 426, 157, -1000, 147, -1000, 352, 370, 415, 370, -1000, - -1000, -1000, 241, 241, 473, 373, -1000, 415, 415, -1000, - -1000, -1000, 342, 88, 148, 88, -33, -1000, -35, 241, - 473, -1000, 266, -1000, 241, -1000, 138, -1000, 371, 304, - -1000, -1000, 241, 241, -1000, + 54, -1000, -1000, 184, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, -1000, -1000, -8, -28, -7, + -5, 384, 335, -1000, -1000, -1000, 329, -1000, 308, 286, + 373, 242, -35, 4, -1000, -33, -1000, 288, -36, 239, + -1000, -1000, 334, -1000, 348, 286, 292, 60, 286, 170, + -1000, 182, -1000, 44, 282, 74, 239, 281, -25, 272, + 325, 121, -1000, 213, -1000, -1000, 327, 24, 102, 444, + -1000, 404, 383, -1000, -1000, 409, 226, 225, -1000, 220, + -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 313, + -1000, 214, 242, 271, 370, 242, 404, 239, -1000, 322, + -48, 130, 262, -1000, -1000, 257, 224, 334, 239, -1000, + 111, 404, 404, 409, 195, 332, 409, 409, 128, 409, + 409, 409, 409, 409, 409, 409, 409, -1000, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, 444, -40, 20, -9, 444, + -1000, 174, 212, 334, 384, 66, 53, -1000, 404, 404, + 330, 242, 208, -1000, 355, 404, -1000, -1000, -1000, -1000, + -1000, 107, 239, -1000, -26, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 204, 244, 251, 145, 18, -1000, -1000, -1000, + -1000, -1000, 486, -1000, 174, 195, 409, 409, 486, 478, + -1000, 314, 108, 108, 108, 76, 76, -1000, -1000, -1000, + -1000, -1000, 409, -1000, 486, -1000, -11, 334, -12, 16, + -1000, -1000, 26, -4, -1000, 95, 195, 184, -14, -1000, + 355, 350, 353, 102, 254, -1000, -1000, 252, -1000, 363, + 218, 218, -1000, -1000, 166, 139, 151, 149, 147, -27, + 1, 384, -1000, 245, 3, -2, 243, -18, -3, -1000, + 486, 467, 409, -1000, 486, -1000, -30, -1000, -1000, -1000, + 404, -1000, 299, 185, -1000, -1000, 242, 350, -1000, 409, + 409, -1000, -1000, 357, 352, 244, 92, -1000, 137, -1000, + 136, -1000, -1000, -1000, -1000, -1000, 113, 207, 197, -1000, + -1000, -1000, 409, 486, -1000, -1000, 297, 195, -1000, -1000, + 456, 176, -1000, 433, -1000, 355, 404, 409, 404, -1000, + -1000, -1000, 239, 239, 486, 380, -1000, 409, 409, -1000, + -1000, -1000, 350, 102, 171, 102, -34, -1000, -37, 242, + 486, -1000, 259, -1000, 239, -1000, 170, -1000, 377, 319, + -1000, -1000, 239, 239, -1000, } var yyPgo = []int{ - 0, 503, 502, 21, 492, 491, 481, 480, 478, 477, - 476, 474, 454, 473, 472, 460, 27, 25, 19, 15, - 458, 10, 457, 449, 229, 9, 24, 17, 439, 438, - 436, 435, 8, 7, 1, 434, 433, 431, 14, 13, - 12, 417, 415, 413, 6, 411, 3, 410, 5, 404, - 401, 400, 399, 4, 2, 44, 393, 391, 387, 386, - 385, 381, 380, 0, 11, 375, + 0, 478, 477, 21, 473, 472, 470, 469, 464, 463, + 462, 458, 360, 456, 451, 449, 11, 36, 20, 18, + 443, 12, 438, 436, 242, 9, 24, 17, 435, 433, + 430, 428, 14, 7, 1, 426, 423, 422, 13, 15, + 6, 417, 416, 415, 5, 414, 3, 413, 8, 410, + 409, 402, 400, 4, 2, 37, 399, 398, 397, 396, + 395, 393, 390, 0, 10, 389, } var yyR1 = []int{ @@ -465,23 +467,23 @@ var yyChk = []int{ 85, -14, 49, 50, 51, 52, -12, -65, -12, -12, -12, -12, 87, -61, 92, -58, 90, 87, 87, 88, -3, 17, -15, 18, -13, 29, -24, 35, 8, -54, - -55, -63, 35, -57, 91, 88, 87, 35, -56, 91, - -63, -16, -17, 73, -18, 35, -27, -34, -28, 67, - 44, -41, -40, -36, -63, -35, -37, 20, 36, 37, - 38, 25, 71, 72, 48, 91, 28, 78, 15, -24, - 33, 76, -24, 53, 45, 35, 67, -63, 35, 89, - 35, 20, 64, 8, 53, -19, 19, 76, 65, 66, - -29, 21, 67, 23, 24, 22, 68, 69, 70, 71, - 72, 73, 74, 75, 45, 46, 47, 39, 40, 41, - 42, -27, -34, 35, -27, -3, -33, -34, -34, 44, - 44, 44, 44, -38, -18, -39, 79, 81, -51, 44, - -54, 35, -26, 9, -55, -18, -64, 20, -62, 93, - -59, 86, 84, 32, 85, 12, 35, 35, 35, -20, - -21, 44, -23, 35, -17, -63, 73, -63, -27, -27, - -34, -32, 44, 21, 23, 24, -34, -34, 25, 67, - -34, -34, -34, -34, -34, -34, -34, -34, 76, 115, - 115, 53, 115, -34, 115, -16, 18, -16, -3, 82, - -39, -38, -18, -18, -30, 28, -3, -52, -40, -63, + -55, -40, -63, 35, -57, 91, 88, 87, 35, -56, + 91, -63, 35, -16, -17, 73, -18, 35, -27, -34, + -28, 67, 44, -41, -40, -36, -63, -35, -37, 20, + 36, 37, 38, 25, 71, 72, 48, 91, 28, 78, + 15, -24, 33, 76, -24, 53, 45, 76, 35, 67, + -63, 35, 89, 35, 20, 64, 8, 53, -19, 19, + 76, 65, 66, -29, 21, 67, 23, 24, 22, 68, + 69, 70, 71, 72, 73, 74, 75, 45, 46, 47, + 39, 40, 41, 42, -27, -34, -27, -3, -33, -34, + -34, 44, 44, 44, 44, -38, -18, -39, 79, 81, + -51, 44, -54, 35, -26, 9, -55, -18, -63, -64, + 20, -62, 93, -59, 86, 84, 32, 85, 12, 35, + 35, 35, -20, -21, 44, -23, 35, -17, -63, 73, + -27, -27, -34, -32, 44, 21, 23, 24, -34, -34, + 25, 67, -34, -34, -34, -34, -34, -34, -34, -34, + 115, 115, 53, 115, -34, 115, -16, 18, -16, -3, + 82, -39, -38, -18, -18, -30, 28, -3, -52, -40, -26, -44, 12, -27, 64, -63, -64, -60, 89, -26, 53, -22, 54, 55, 56, 57, 58, 60, 61, -21, -3, 44, -25, -19, 62, 63, 76, -33, -3, -32, @@ -503,23 +505,23 @@ var yyDef = []int{ 0, 0, 28, 30, 31, 32, 33, 26, 0, 0, 0, 0, 167, 0, 179, 0, 170, 0, 165, 0, 12, 29, 0, 34, 25, 0, 0, 64, 0, 16, - 162, 0, 182, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 35, 37, -2, 182, 41, 42, 71, 0, - 0, 101, 102, 0, 130, 0, 118, 0, 132, 133, - 134, 135, 121, 122, 123, 119, 120, 0, 27, 154, - 0, 0, 69, 0, 0, 183, 0, 180, 0, 0, - 22, 166, 0, 0, 0, 0, 44, 0, 0, 0, + 162, 0, 130, 182, 0, 0, 0, 0, 0, 0, + 0, 0, 182, 0, 35, 37, -2, 182, 41, 42, + 71, 0, 0, 101, 102, 0, 130, 0, 118, 0, + 132, 133, 134, 135, 121, 122, 123, 119, 120, 0, + 27, 154, 0, 0, 69, 0, 0, 0, 183, 0, + 180, 0, 0, 22, 166, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 86, 87, 88, 89, 90, 91, - 92, 74, 0, 182, 0, 0, 0, 99, 113, 0, - 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, - 69, 65, 140, 0, 163, 164, 17, 168, 0, 0, - 183, 176, 171, 172, 173, 174, 175, 21, 23, 69, - 45, 0, -2, 61, 36, 39, 40, 131, 72, 73, - 76, 77, 0, 0, 0, 0, 79, 0, 83, 0, - 105, 106, 107, 108, 109, 110, 111, 112, 0, 75, - 103, 0, 104, 99, 114, 0, 0, 0, 0, 124, - 127, 0, 0, 129, 160, 0, 94, 0, 156, 130, + 0, 0, 0, 0, 0, 0, 0, 86, 87, 88, + 89, 90, 91, 92, 74, 0, 0, 0, 0, 99, + 113, 0, 0, 0, 0, 0, 0, 126, 0, 0, + 0, 0, 69, 65, 140, 0, 163, 164, 131, 17, + 168, 0, 0, 183, 176, 171, 172, 173, 174, 175, + 21, 23, 69, 45, 0, -2, 61, 36, 39, 40, + 72, 73, 76, 77, 0, 0, 0, 0, 79, 0, + 83, 0, 105, 106, 107, 108, 109, 110, 111, 112, + 75, 103, 0, 104, 99, 114, 0, 0, 0, 0, + 124, 127, 0, 0, 129, 160, 0, 94, 0, 156, 140, 148, 0, 70, 0, 181, 19, 0, 177, 136, 0, 0, 52, 53, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 78, diff --git a/go/vt/sqlparser/sql.y b/go/vt/sqlparser/sql.y index 6977974435..c2a8dec780 100644 --- a/go/vt/sqlparser/sql.y +++ b/go/vt/sqlparser/sql.y @@ -859,7 +859,7 @@ update_list: } update_expression: - sql_id '=' expression + column_name '=' expression { $$ = $2.PushTwo($1, $3) } diff --git a/test/queryservice_tests/nocache_cases.py b/test/queryservice_tests/nocache_cases.py index de80aaddf2..d2d254e30c 100644 --- a/test/queryservice_tests/nocache_cases.py +++ b/test/queryservice_tests/nocache_cases.py @@ -441,6 +441,18 @@ cases = [ "update vtocc_a set eid=1 where id=1", 'commit']), + MultiCase( + 'pk change with qualifed column name', + ['begin', + Case(sql="update vtocc_a set vtocc_a.eid = 2 where eid = 1 and id = 1", + rewritten="update vtocc_a set vtocc_a.eid = 2 where eid = 1 and id = 1 /* _stream vtocc_a (eid id ) (1 1 ) (2 1 )"), + 'commit', + Case(sql='select eid from vtocc_a where id = 1', + result=[(2L,)]), + 'begin', + "update vtocc_a set eid=1 where id=1", + 'commit']), + MultiCase( 'partial pk', ['begin',