diff --git a/sql/parser.go b/sql/parser.go index ca7e762..59fdadc 100644 --- a/sql/parser.go +++ b/sql/parser.go @@ -165,67 +165,69 @@ var yyExca = [...]int{ -1, 1, 1, -1, -2, 0, - -1, 77, + -1, 80, 59, 6, - -2, 87, - -1, 78, - 59, 7, -2, 88, + -1, 81, + 59, 7, + -2, 89, } const yyPrivate = 57344 -const yyLast = 195 +const yyLast = 203 var yyAct = [...]int{ - 73, 160, 9, 125, 88, 71, 10, 68, 74, 127, - 147, 61, 75, 134, 18, 153, 69, 10, 21, 134, - 23, 135, 95, 26, 131, 72, 108, 31, 32, 26, - 99, 106, 102, 101, 100, 84, 52, 122, 130, 95, - 129, 124, 77, 76, 78, 59, 62, 82, 80, 81, - 62, 79, 63, 64, 60, 67, 95, 94, 96, 93, - 65, 66, 47, 36, 62, 37, 63, 64, 62, 82, - 80, 81, 91, 92, 99, 46, 22, 101, 100, 17, - 28, 35, 65, 66, 48, 103, 11, 55, 12, 91, - 92, 114, 107, 104, 105, 158, 13, 15, 87, 139, - 6, 157, 115, 111, 33, 117, 118, 119, 121, 10, - 116, 126, 112, 51, 123, 39, 16, 133, 27, 11, - 128, 12, 58, 44, 85, 159, 25, 45, 141, 49, - 5, 162, 83, 167, 57, 10, 136, 138, 86, 50, - 145, 53, 152, 142, 155, 43, 42, 143, 10, 40, - 126, 150, 166, 164, 56, 34, 19, 89, 8, 41, - 149, 165, 163, 144, 35, 140, 161, 137, 90, 98, - 110, 168, 132, 151, 148, 20, 120, 70, 113, 154, - 156, 29, 38, 109, 97, 54, 14, 30, 24, 7, - 146, 4, 3, 2, 1, + 76, 163, 9, 128, 91, 74, 10, 71, 77, 130, + 150, 64, 78, 137, 18, 156, 72, 10, 21, 137, + 23, 138, 75, 26, 98, 29, 134, 32, 32, 34, + 26, 133, 98, 132, 127, 98, 58, 99, 55, 80, + 79, 81, 111, 65, 85, 83, 84, 62, 82, 109, + 97, 102, 96, 105, 104, 103, 63, 70, 125, 68, + 69, 87, 38, 65, 39, 66, 67, 65, 85, 83, + 84, 50, 51, 48, 102, 94, 95, 104, 103, 65, + 117, 66, 67, 22, 17, 11, 37, 12, 106, 161, + 27, 41, 94, 95, 90, 110, 107, 108, 11, 142, + 12, 68, 69, 35, 54, 118, 114, 160, 120, 121, + 122, 124, 10, 119, 129, 115, 27, 126, 6, 162, + 52, 16, 136, 131, 11, 170, 12, 165, 28, 89, + 53, 144, 59, 46, 13, 15, 40, 47, 10, 139, + 141, 59, 56, 148, 169, 61, 145, 25, 5, 167, + 146, 10, 88, 129, 153, 45, 44, 86, 166, 42, + 60, 31, 164, 155, 168, 19, 147, 92, 143, 43, + 49, 8, 158, 152, 37, 140, 101, 36, 93, 113, + 171, 135, 154, 151, 123, 73, 116, 157, 20, 33, + 159, 30, 112, 100, 57, 14, 24, 7, 149, 4, + 3, 2, 1, } var yyPact = [...]int{ - 87, -1000, -1000, -1000, -1000, 36, 51, 58, -1000, -1000, - -1000, -1000, -1000, 36, 131, -1000, 36, 36, 17, 36, - -1000, -1000, 36, 84, 22, -1000, 36, 36, 69, 5, - 113, 16, 3, 93, -1000, 36, 152, 38, 113, -1000, - 106, -1000, -1000, 89, 36, 10, -4, -8, -1000, 104, - -24, 96, -1000, 93, -1000, 56, -1000, 150, -1000, -1000, - -1000, -1000, -1000, -4, -4, -1000, -1000, -1, -2, -1000, - 159, 21, -1000, -27, -1000, -1000, -1000, -1000, -1000, -8, - 14, 14, -1000, -28, -8, -33, -1000, -1000, 162, -1000, - -1000, -1000, -1000, -1000, -4, -8, 43, 150, 32, -8, - -8, -8, -8, -23, -1000, -1000, -8, -19, 36, -1000, - -1000, -51, -1000, -1000, -8, -1000, -1000, 21, 21, 21, - -20, 21, -1000, -36, 83, -39, -1000, -1000, 21, -1000, - -8, -1000, -1000, 156, 36, 62, 21, 124, -1000, 36, - -1000, -1000, -1000, -1000, -1000, -49, 145, 36, 116, -1000, - -45, -1000, 128, -1000, 67, -1000, -1000, 78, 122, 122, - -1000, 119, -1000, -1000, 166, -1000, -1000, -1000, -1000, + 105, -1000, -1000, -1000, -1000, 35, 89, 63, -1000, -1000, + -1000, -1000, -1000, 35, 140, -1000, 35, 35, 24, 35, + -1000, -1000, 48, 94, -33, -1000, 35, 35, 35, 74, + 4, 123, 14, 123, 12, 84, -1000, 35, 162, -13, + 123, -1000, 132, -1000, -1000, 112, 35, 9, 25, 123, + -11, -1000, 129, 2, 124, -1000, 84, -1000, 52, -1000, + 160, -1000, -1000, -1000, -1000, -1000, 25, 25, -1000, -1000, + -8, -23, -1000, 166, 21, -1000, -6, -1000, -1000, -1000, + -1000, -1000, -11, 13, 13, -1000, -10, -11, -17, -1000, + -1000, 171, -1000, -1000, -1000, -1000, -1000, 25, -11, 32, + 160, 51, -11, -11, -11, -11, -2, -1000, -1000, -11, + -26, 35, -1000, -1000, -51, -1000, -1000, -11, -1000, -1000, + 21, 21, 21, -27, 21, -1000, -34, 88, -39, -1000, + -1000, 21, -1000, -11, -1000, -1000, 164, 35, 62, 21, + 127, -1000, 35, -1000, -1000, -1000, -1000, -1000, -49, 158, + 35, 137, -1000, -45, -1000, 156, -1000, 73, -1000, -1000, + 72, 118, 118, -1000, 111, -1000, -1000, 175, -1000, -1000, + -1000, -1000, } var yyPgo = [...]int{ - 0, 194, 193, 192, 191, 0, 11, 8, 12, 2, - 158, 3, 190, 189, 188, 126, 7, 16, 187, 104, - 186, 185, 184, 4, 183, 115, 182, 84, 181, 1, - 180, 179, 178, 177, 5, 176, 174, 173, 172, + 0, 202, 201, 200, 199, 0, 11, 8, 12, 2, + 171, 3, 198, 197, 196, 147, 7, 16, 161, 103, + 195, 194, 193, 4, 192, 91, 136, 72, 191, 1, + 190, 187, 186, 185, 5, 184, 183, 182, 181, } var yyR1 = [...]int{ @@ -233,12 +235,12 @@ var yyR1 = [...]int{ 7, 8, 8, 8, 9, 11, 11, 12, 10, 13, 13, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 19, 19, 28, 28, 28, 24, - 24, 14, 14, 15, 18, 18, 18, 18, 22, 22, - 23, 23, 23, 21, 21, 20, 20, 38, 38, 38, - 38, 38, 38, 16, 16, 33, 17, 29, 29, 29, - 29, 29, 30, 30, 31, 31, 36, 36, 37, 37, - 32, 32, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 35, 35, 35, 2, 3, 4, + 24, 14, 14, 15, 15, 18, 18, 18, 18, 22, + 22, 23, 23, 23, 21, 21, 20, 20, 38, 38, + 38, 38, 38, 38, 16, 16, 33, 17, 29, 29, + 29, 29, 29, 30, 30, 31, 31, 36, 36, 37, + 37, 32, 32, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 35, 35, 35, 2, 3, 4, } var yyR2 = [...]int{ @@ -246,52 +248,54 @@ var yyR2 = [...]int{ 2, 1, 2, 2, 1, 1, 3, 3, 1, 1, 3, 4, 1, 1, 2, 2, 2, 2, 0, 1, 2, 5, 5, 11, 0, 2, 0, 3, 4, 0, - 1, 1, 3, 3, 0, 1, 4, 6, 0, 2, - 0, 1, 1, 0, 2, 0, 1, 0, 3, 3, - 3, 3, 3, 1, 3, 1, 3, 2, 2, 1, - 1, 2, 3, 3, 0, 2, 0, 1, 0, 2, - 0, 2, 1, 4, 1, 1, 1, 1, 1, 3, - 3, 3, 3, 0, 1, 3, 4, 8, 10, + 1, 1, 3, 3, 3, 0, 1, 4, 6, 0, + 2, 0, 1, 1, 0, 2, 0, 1, 0, 3, + 3, 3, 3, 3, 1, 3, 1, 3, 2, 2, + 1, 1, 2, 3, 3, 0, 2, 0, 1, 0, + 2, 0, 2, 1, 4, 1, 1, 1, 1, 1, + 3, 3, 3, 3, 0, 1, 3, 4, 8, 10, } var yyChk = [...]int{ -1000, -1, -2, -3, -4, 43, 13, -13, -10, -9, -5, 50, 52, 45, -20, 46, 58, 21, -5, 25, - -10, -5, 59, -5, -14, -15, -5, 34, 58, -28, - -18, -5, -5, -19, -15, 12, 58, 60, -26, -25, - 36, 46, 33, 32, 10, 14, 59, 59, -27, 36, - 46, 20, -5, -19, -21, 49, -25, 28, 33, -5, - -7, -6, 54, 56, 57, 50, 51, -7, -16, -17, - -33, -34, 33, -5, -7, -8, 51, 50, 52, 59, - 56, 57, 55, 28, 59, 28, -27, 42, -23, 7, - 18, -7, -7, 60, 58, 58, 60, -22, 10, 53, - 57, 56, 59, -34, -8, -8, 59, -16, 59, -24, - 8, -7, -17, -32, 48, -23, -6, -34, -34, -34, - -35, -34, 60, -16, 60, -11, -9, 60, -34, 60, - 58, 60, -38, 34, 58, 60, -34, 11, -9, 37, - 41, 4, 19, 23, 39, -5, -12, 59, -36, 15, - -11, -37, 26, 60, -31, 16, -30, 34, 17, 47, - -29, 44, 9, 40, 31, -29, 33, 14, 5, + -10, -5, 59, -5, -14, -15, -5, 42, 34, 58, + -28, -18, -5, -18, -5, -19, -15, 12, 58, 60, + -26, -25, 36, 46, 33, 32, 10, 14, 59, -26, + 59, -27, 36, 46, 20, -5, -19, -21, 49, -25, + 28, 33, -5, -7, -6, 54, 56, 57, 50, 51, + -7, -16, -17, -33, -34, 33, -5, -7, -8, 51, + 50, 52, 59, 56, 57, 55, 28, 59, 28, -27, + 42, -23, 7, 18, -7, -7, 60, 58, 58, 60, + -22, 10, 53, 57, 56, 59, -34, -8, -8, 59, + -16, 59, -24, 8, -7, -17, -32, 48, -23, -6, + -34, -34, -34, -35, -34, 60, -16, 60, -11, -9, + 60, -34, 60, 58, 60, -38, 34, 58, 60, -34, + 11, -9, 37, 41, 4, 19, 23, 39, -5, -12, + 59, -36, 15, -11, -37, 26, 60, -31, 16, -30, + 34, 17, 47, -29, 44, 9, 40, 31, -29, 33, + 14, 5, } var yyDef = [...]int{ - 0, -2, 1, 2, 3, 0, 55, 0, 19, 18, - 14, 6, 7, 0, 0, 56, 0, 0, 0, 0, - 20, 96, 0, 0, 36, 41, 44, 0, 34, 0, - 28, 45, 0, 0, 42, 0, 34, 53, 43, 29, - 0, 22, 23, 0, 0, 0, 0, 0, 37, 0, - 0, 0, 35, 0, 97, 0, 30, 50, 24, 25, - 26, 27, 8, 0, 0, 4, 5, 0, 0, 63, - 48, 65, 82, 0, 84, 85, 86, -2, -2, 0, - 0, 0, 11, 0, 0, 0, 38, 54, 39, 51, - 52, 9, 10, 46, 0, 0, 80, 50, 0, 0, - 0, 0, 93, 0, 12, 13, 0, 0, 0, 21, - 40, 0, 64, 98, 0, 66, 49, 89, 90, 91, - 0, 94, 92, 0, 57, 0, 15, 47, 81, 83, - 0, 31, 32, 0, 0, 0, 95, 0, 16, 0, - 58, 59, 60, 61, 62, 0, 76, 0, 78, 77, - 0, 74, 0, 17, 33, 79, 75, 0, 0, 0, - 72, 0, 69, 70, 0, 73, 67, 68, 71, + 0, -2, 1, 2, 3, 0, 56, 0, 19, 18, + 14, 6, 7, 0, 0, 57, 0, 0, 0, 0, + 20, 97, 0, 0, 36, 41, 45, 45, 0, 34, + 0, 28, 46, 28, 0, 0, 42, 0, 34, 54, + 43, 29, 0, 22, 23, 0, 0, 0, 0, 44, + 0, 37, 0, 0, 0, 35, 0, 98, 0, 30, + 51, 24, 25, 26, 27, 8, 0, 0, 4, 5, + 0, 0, 64, 49, 66, 83, 0, 85, 86, 87, + -2, -2, 0, 0, 0, 11, 0, 0, 0, 38, + 55, 39, 52, 53, 9, 10, 47, 0, 0, 81, + 51, 0, 0, 0, 0, 94, 0, 12, 13, 0, + 0, 0, 21, 40, 0, 65, 99, 0, 67, 50, + 90, 91, 92, 0, 95, 93, 0, 58, 0, 15, + 48, 82, 84, 0, 31, 32, 0, 0, 0, 96, + 0, 16, 0, 59, 60, 61, 62, 63, 0, 77, + 0, 79, 78, 0, 75, 0, 17, 33, 80, 76, + 0, 0, 0, 73, 0, 70, 71, 0, 74, 68, + 69, 72, } var yyTok1 = [...]int{ @@ -897,48 +901,48 @@ yydefault: yyVAL.columnDef = makeColumnDef(yyDollar[1].identifier, yyDollar[2].name, yyDollar[3].columnConstraintList) } case 44: - yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:286 + yyDollar = yyS[yypt-3 : yypt+1] +//line parser.go.y:284 { - yyVAL.name = "" + yyVAL.columnDef = makeColumnDef("ROWID", yyDollar[2].name, yyDollar[3].columnConstraintList) } case 45: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-0 : yypt+1] //line parser.go.y:289 { - yyVAL.name = yyDollar[1].identifier + yyVAL.name = "" } case 46: - yyDollar = yyS[yypt-4 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line parser.go.y:292 { yyVAL.name = yyDollar[1].identifier } case 47: - yyDollar = yyS[yypt-6 : yypt+1] + yyDollar = yyS[yypt-4 : yypt+1] //line parser.go.y:295 { yyVAL.name = yyDollar[1].identifier } case 48: - yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:300 + yyDollar = yyS[yypt-6 : yypt+1] +//line parser.go.y:298 { + yyVAL.name = yyDollar[1].identifier } case 49: - yyDollar = yyS[yypt-2 : yypt+1] -//line parser.go.y:301 + yyDollar = yyS[yypt-0 : yypt+1] +//line parser.go.y:303 { - yyVAL.collate = yyDollar[2].literal } case 50: - yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:306 + yyDollar = yyS[yypt-2 : yypt+1] +//line parser.go.y:304 { - yyVAL.sortOrder = Asc + yyVAL.collate = yyDollar[2].literal } case 51: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-0 : yypt+1] //line parser.go.y:309 { yyVAL.sortOrder = Asc @@ -947,209 +951,209 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser.go.y:312 { - yyVAL.sortOrder = Desc + yyVAL.sortOrder = Asc } case 53: - yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:317 + yyDollar = yyS[yypt-1 : yypt+1] +//line parser.go.y:315 { - yyVAL.withoutRowid = false + yyVAL.sortOrder = Desc } case 54: - yyDollar = yyS[yypt-2 : yypt+1] + yyDollar = yyS[yypt-0 : yypt+1] //line parser.go.y:320 { - yyVAL.withoutRowid = true + yyVAL.withoutRowid = false } case 55: - yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:325 + yyDollar = yyS[yypt-2 : yypt+1] +//line parser.go.y:323 { - yyVAL.unique = false + yyVAL.withoutRowid = true } case 56: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-0 : yypt+1] //line parser.go.y:328 { - yyVAL.unique = true + yyVAL.unique = false } case 57: - yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:333 + yyDollar = yyS[yypt-1 : yypt+1] +//line parser.go.y:331 { + yyVAL.unique = true } case 58: - yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:334 + yyDollar = yyS[yypt-0 : yypt+1] +//line parser.go.y:336 { } case 59: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:336 +//line parser.go.y:337 { } case 60: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:338 +//line parser.go.y:339 { } case 61: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:340 +//line parser.go.y:341 { } case 62: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:342 +//line parser.go.y:343 { } case 63: + yyDollar = yyS[yypt-3 : yypt+1] +//line parser.go.y:345 + { + } + case 64: yyDollar = yyS[yypt-1 : yypt+1] -//line parser.go.y:346 +//line parser.go.y:349 { yyVAL.indexedColumnList = []IndexedColumn{yyDollar[1].indexedColumn} } - case 64: + case 65: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:349 +//line parser.go.y:352 { yyVAL.indexedColumnList = append(yyDollar[1].indexedColumnList, yyDollar[3].indexedColumn) } - case 65: + case 66: yyDollar = yyS[yypt-1 : yypt+1] -//line parser.go.y:354 +//line parser.go.y:357 { yyVAL.expr = yyDollar[1].expr } - case 66: + case 67: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:359 +//line parser.go.y:362 { yyVAL.indexedColumn = newIndexColumn(yyDollar[1].expr, yyDollar[2].collate, yyDollar[3].sortOrder) } - case 67: + case 68: yyDollar = yyS[yypt-2 : yypt+1] -//line parser.go.y:364 +//line parser.go.y:367 { yyVAL.triggerAction = ActionSetNull } - case 68: + case 69: yyDollar = yyS[yypt-2 : yypt+1] -//line parser.go.y:367 +//line parser.go.y:370 { yyVAL.triggerAction = ActionSetDefault } - case 69: + case 70: yyDollar = yyS[yypt-1 : yypt+1] -//line parser.go.y:370 +//line parser.go.y:373 { yyVAL.triggerAction = ActionCascade } - case 70: + case 71: yyDollar = yyS[yypt-1 : yypt+1] -//line parser.go.y:373 +//line parser.go.y:376 { yyVAL.triggerAction = ActionRestrict } - case 71: + case 72: yyDollar = yyS[yypt-2 : yypt+1] -//line parser.go.y:376 +//line parser.go.y:379 { yyVAL.triggerAction = ActionNoAction } - case 72: + case 73: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:381 +//line parser.go.y:384 { yyVAL.trigger = TriggerOnDelete(yyDollar[3].triggerAction) } - case 73: + case 74: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:384 +//line parser.go.y:387 { yyVAL.trigger = TriggerOnUpdate(yyDollar[3].triggerAction) } - case 74: + case 75: yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:389 +//line parser.go.y:392 { } - case 75: + case 76: yyDollar = yyS[yypt-2 : yypt+1] -//line parser.go.y:390 +//line parser.go.y:393 { yyVAL.triggerList = append(yyDollar[1].triggerList, yyDollar[2].trigger) } - case 76: + case 77: yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:395 +//line parser.go.y:398 { yyVAL.bool = false } - case 77: + case 78: yyDollar = yyS[yypt-1 : yypt+1] -//line parser.go.y:398 +//line parser.go.y:401 { yyVAL.bool = true } - case 78: + case 79: yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:403 +//line parser.go.y:406 { yyVAL.bool = false } - case 79: + case 80: yyDollar = yyS[yypt-2 : yypt+1] -//line parser.go.y:406 +//line parser.go.y:409 { yyVAL.bool = true } - case 80: + case 81: yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:411 +//line parser.go.y:414 { } - case 81: + case 82: yyDollar = yyS[yypt-2 : yypt+1] -//line parser.go.y:412 +//line parser.go.y:415 { yyVAL.where = yyDollar[2].expr } - case 82: - yyDollar = yyS[yypt-1 : yypt+1] -//line parser.go.y:417 - { - yyVAL.expr = nil - } case 83: - yyDollar = yyS[yypt-4 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line parser.go.y:420 { - yyVAL.expr = ExFunction{yyDollar[1].identifier, yyDollar[3].exprList} + yyVAL.expr = nil } case 84: - yyDollar = yyS[yypt-1 : yypt+1] + yyDollar = yyS[yypt-4 : yypt+1] //line parser.go.y:423 { - yyVAL.expr = yyDollar[1].signedNumber + yyVAL.expr = ExFunction{yyDollar[1].identifier, yyDollar[3].exprList} } case 85: yyDollar = yyS[yypt-1 : yypt+1] //line parser.go.y:426 { - yyVAL.expr = yyDollar[1].float + yyVAL.expr = yyDollar[1].signedNumber } case 86: yyDollar = yyS[yypt-1 : yypt+1] //line parser.go.y:429 { - yyVAL.expr = yyDollar[1].identifier + yyVAL.expr = yyDollar[1].float } case 87: yyDollar = yyS[yypt-1 : yypt+1] //line parser.go.y:432 { - yyVAL.expr = ExColumn(yyDollar[1].identifier) + yyVAL.expr = yyDollar[1].identifier } case 88: yyDollar = yyS[yypt-1 : yypt+1] @@ -1158,56 +1162,62 @@ yydefault: yyVAL.expr = ExColumn(yyDollar[1].identifier) } case 89: - yyDollar = yyS[yypt-3 : yypt+1] + yyDollar = yyS[yypt-1 : yypt+1] //line parser.go.y:438 { - yyVAL.expr = ExBinaryOp{yyDollar[2].identifier, yyDollar[1].expr, yyDollar[3].expr} + yyVAL.expr = ExColumn(yyDollar[1].identifier) } case 90: yyDollar = yyS[yypt-3 : yypt+1] //line parser.go.y:441 { - yyVAL.expr = ExBinaryOp{"+", yyDollar[1].expr, yyDollar[3].expr} + yyVAL.expr = ExBinaryOp{yyDollar[2].identifier, yyDollar[1].expr, yyDollar[3].expr} } case 91: yyDollar = yyS[yypt-3 : yypt+1] //line parser.go.y:444 { - yyVAL.expr = ExBinaryOp{"-", yyDollar[1].expr, yyDollar[3].expr} + yyVAL.expr = ExBinaryOp{"+", yyDollar[1].expr, yyDollar[3].expr} } case 92: yyDollar = yyS[yypt-3 : yypt+1] //line parser.go.y:447 { - yyVAL.expr = yyDollar[2].expr + yyVAL.expr = ExBinaryOp{"-", yyDollar[1].expr, yyDollar[3].expr} } case 93: + yyDollar = yyS[yypt-3 : yypt+1] +//line parser.go.y:450 + { + yyVAL.expr = yyDollar[2].expr + } + case 94: yyDollar = yyS[yypt-0 : yypt+1] -//line parser.go.y:452 +//line parser.go.y:455 { yyVAL.exprList = nil } - case 94: + case 95: yyDollar = yyS[yypt-1 : yypt+1] -//line parser.go.y:455 +//line parser.go.y:458 { yyVAL.exprList = []Expression{yyDollar[1].expr} } - case 95: + case 96: yyDollar = yyS[yypt-3 : yypt+1] -//line parser.go.y:458 +//line parser.go.y:461 { yyVAL.exprList = append(yyDollar[1].exprList, yyDollar[3].expr) } - case 96: + case 97: yyDollar = yyS[yypt-4 : yypt+1] -//line parser.go.y:463 +//line parser.go.y:466 { yylex.(*lexer).result = SelectStmt{Columns: yyDollar[2].columnNameList, Table: yyDollar[4].identifier} } - case 97: + case 98: yyDollar = yyS[yypt-8 : yypt+1] -//line parser.go.y:468 +//line parser.go.y:471 { yylex.(*lexer).result = CreateTableStmt{ Table: yyDollar[3].identifier, @@ -1216,9 +1226,9 @@ yydefault: WithoutRowid: yyDollar[8].withoutRowid, } } - case 98: + case 99: yyDollar = yyS[yypt-10 : yypt+1] -//line parser.go.y:478 +//line parser.go.y:481 { yylex.(*lexer).result = CreateIndexStmt{ Index: yyDollar[4].identifier, diff --git a/sql/parser.go.y b/sql/parser.go.y index 317e168..f954f73 100644 --- a/sql/parser.go.y +++ b/sql/parser.go.y @@ -280,6 +280,9 @@ columnDefList: columnDef: identifier typeName columnConstraintList { $$ = makeColumnDef($1, $2, $3) + } | + ROWID typeName columnConstraintList { + $$ = makeColumnDef("ROWID", $2, $3) } typeName: diff --git a/sql/sql_test.go b/sql/sql_test.go index 3b74775..ea9974e 100644 --- a/sql/sql_test.go +++ b/sql/sql_test.go @@ -286,6 +286,10 @@ func TestCreateTable(t *testing.T) { "i0 not null default foo": &ColumnDef{Name: "i0", Default: "foo"}, "i0 not null default 'foo'": &ColumnDef{Name: "i0", Default: "foo"}, "i0 not null default [foo]": nil, + + "integer integer primary key": &ColumnDef{Name: "integer", Type: "integer", PrimaryKey: true, PrimaryKeyDir: Asc, Null: true}, + "ROWID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE": &ColumnDef{Name: "ROWID", Type: "INTEGER", PrimaryKey: true, Unique: true, AutoIncrement: true, Null: true}, + "select integer primary key": nil, } for sql, col := range cases {