diff --git a/packages/sql-parser/base/fromClauseParser.js b/packages/sql-parser/base/fromClauseParser.js index bb063b13..a9f03b8e 100644 --- a/packages/sql-parser/base/fromClauseParser.js +++ b/packages/sql-parser/base/fromClauseParser.js @@ -284,44 +284,49 @@ function peg$parse(input, options) { var peg$c105 = "not"; var peg$c106 = "and"; var peg$c107 = "or"; - var peg$c108 = "count"; - var peg$c109 = "max"; - var peg$c110 = "min"; - var peg$c111 = "sum"; - var peg$c112 = "avg"; - var peg$c113 = "cast"; - var peg$c114 = "recursive"; - var peg$c115 = "foreign key"; - var peg$c116 = "references"; - var peg$c117 = "index"; - var peg$c118 = "cascade"; - var peg$c119 = "set null"; - var peg$c120 = "set default"; - var peg$c121 = "restrict"; - var peg$c122 = "no action"; - var peg$c123 = "type"; - var peg$c124 = "enum"; - var peg$c125 = "range"; - var peg$c126 = "["; - var peg$c127 = "]"; - var peg$c128 = "{"; - var peg$c129 = "}"; - var peg$c130 = "--"; - var peg$c131 = "/*"; - var peg$c132 = "*/"; - var peg$c133 = ";"; - var peg$c134 = "current_user"; - var peg$c135 = "current_date"; - var peg$c136 = "current_time"; - var peg$c137 = "current_timestamp"; - var peg$c138 = "localtime"; - var peg$c139 = "localtimestamp"; - var peg$c140 = "session_user"; - var peg$c141 = "system_user"; - var peg$c142 = "user"; - var peg$c143 = "$"; - var peg$c144 = "return"; - var peg$c145 = ":="; + var peg$c108 = "to"; + var peg$c109 = "count"; + var peg$c110 = "max"; + var peg$c111 = "min"; + var peg$c112 = "sum"; + var peg$c113 = "avg"; + var peg$c114 = "cast"; + var peg$c115 = "recursive"; + var peg$c116 = "foreign key"; + var peg$c117 = "references"; + var peg$c118 = "index"; + var peg$c119 = "cascade"; + var peg$c120 = "set null"; + var peg$c121 = "set default"; + var peg$c122 = "restrict"; + var peg$c123 = "no action"; + var peg$c124 = "type"; + var peg$c125 = "enum"; + var peg$c126 = "range"; + var peg$c127 = "["; + var peg$c128 = "]"; + var peg$c129 = "{"; + var peg$c130 = "}"; + var peg$c131 = "--"; + var peg$c132 = "/*"; + var peg$c133 = "*/"; + var peg$c134 = ";"; + var peg$c135 = "current_user"; + var peg$c136 = "current_date"; + var peg$c137 = "current_time"; + var peg$c138 = "current_timestamp"; + var peg$c139 = "localtime"; + var peg$c140 = "localtimestamp"; + var peg$c141 = "session_user"; + var peg$c142 = "system_user"; + var peg$c143 = "user"; + var peg$c144 = "$"; + var peg$c145 = "return"; + var peg$c146 = ":="; + var peg$c147 = "session"; + var peg$c148 = "authorization"; + var peg$c149 = "search_path"; + var peg$c150 = "@"; var peg$r0 = /^[^)]/; var peg$r1 = /^[^`]/; @@ -466,45 +471,50 @@ function peg$parse(input, options) { var peg$e122 = peg$literalExpectation("NOT", true); var peg$e123 = peg$literalExpectation("AND", true); var peg$e124 = peg$literalExpectation("OR", true); - var peg$e125 = peg$literalExpectation("COUNT", true); - var peg$e126 = peg$literalExpectation("MAX", true); - var peg$e127 = peg$literalExpectation("MIN", true); - var peg$e128 = peg$literalExpectation("SUM", true); - var peg$e129 = peg$literalExpectation("AVG", true); - var peg$e130 = peg$literalExpectation("CAST", true); - var peg$e131 = peg$literalExpectation("RECURSIVE", true); - var peg$e132 = peg$literalExpectation("FOREIGN KEY", true); - var peg$e133 = peg$literalExpectation("REFERENCES", true); - var peg$e134 = peg$literalExpectation("INDEX", true); - var peg$e135 = peg$literalExpectation("CASCADE", true); - var peg$e136 = peg$literalExpectation("SET NULL", true); - var peg$e137 = peg$literalExpectation("SET DEFAULT", true); - var peg$e138 = peg$literalExpectation("RESTRICT", true); - var peg$e139 = peg$literalExpectation("NO ACTION", true); - var peg$e140 = peg$literalExpectation("TYPE", true); - var peg$e141 = peg$literalExpectation("ENUM", true); - var peg$e142 = peg$literalExpectation("RANGE", true); - var peg$e143 = peg$literalExpectation("[", false); - var peg$e144 = peg$literalExpectation("]", false); - var peg$e145 = peg$literalExpectation("{", false); - var peg$e146 = peg$literalExpectation("}", false); - var peg$e147 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); - var peg$e148 = peg$literalExpectation("--", false); - var peg$e149 = peg$literalExpectation("/*", false); - var peg$e150 = peg$literalExpectation("*/", false); - var peg$e151 = peg$literalExpectation(";", false); - var peg$e152 = peg$literalExpectation("CURRENT_USER", true); - var peg$e153 = peg$literalExpectation("CURRENT_DATE", true); - var peg$e154 = peg$literalExpectation("CURRENT_TIME", true); - var peg$e155 = peg$literalExpectation("CURRENT_TIMESTAMP", true); - var peg$e156 = peg$literalExpectation("LOCALTIME", true); - var peg$e157 = peg$literalExpectation("LOCALTIMESTAMP", true); - var peg$e158 = peg$literalExpectation("SESSION_USER", true); - var peg$e159 = peg$literalExpectation("SYSTEM_USER", true); - var peg$e160 = peg$literalExpectation("USER", true); - var peg$e161 = peg$literalExpectation("$", false); - var peg$e162 = peg$literalExpectation("return", true); - var peg$e163 = peg$literalExpectation(":=", false); + var peg$e125 = peg$literalExpectation("TO", true); + var peg$e126 = peg$literalExpectation("COUNT", true); + var peg$e127 = peg$literalExpectation("MAX", true); + var peg$e128 = peg$literalExpectation("MIN", true); + var peg$e129 = peg$literalExpectation("SUM", true); + var peg$e130 = peg$literalExpectation("AVG", true); + var peg$e131 = peg$literalExpectation("CAST", true); + var peg$e132 = peg$literalExpectation("RECURSIVE", true); + var peg$e133 = peg$literalExpectation("FOREIGN KEY", true); + var peg$e134 = peg$literalExpectation("REFERENCES", true); + var peg$e135 = peg$literalExpectation("INDEX", true); + var peg$e136 = peg$literalExpectation("CASCADE", true); + var peg$e137 = peg$literalExpectation("SET NULL", true); + var peg$e138 = peg$literalExpectation("SET DEFAULT", true); + var peg$e139 = peg$literalExpectation("RESTRICT", true); + var peg$e140 = peg$literalExpectation("NO ACTION", true); + var peg$e141 = peg$literalExpectation("TYPE", true); + var peg$e142 = peg$literalExpectation("ENUM", true); + var peg$e143 = peg$literalExpectation("RANGE", true); + var peg$e144 = peg$literalExpectation("[", false); + var peg$e145 = peg$literalExpectation("]", false); + var peg$e146 = peg$literalExpectation("{", false); + var peg$e147 = peg$literalExpectation("}", false); + var peg$e148 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); + var peg$e149 = peg$literalExpectation("--", false); + var peg$e150 = peg$literalExpectation("/*", false); + var peg$e151 = peg$literalExpectation("*/", false); + var peg$e152 = peg$literalExpectation(";", false); + var peg$e153 = peg$literalExpectation("CURRENT_USER", true); + var peg$e154 = peg$literalExpectation("CURRENT_DATE", true); + var peg$e155 = peg$literalExpectation("CURRENT_TIME", true); + var peg$e156 = peg$literalExpectation("CURRENT_TIMESTAMP", true); + var peg$e157 = peg$literalExpectation("LOCALTIME", true); + var peg$e158 = peg$literalExpectation("LOCALTIMESTAMP", true); + var peg$e159 = peg$literalExpectation("SESSION_USER", true); + var peg$e160 = peg$literalExpectation("SYSTEM_USER", true); + var peg$e161 = peg$literalExpectation("USER", true); + var peg$e162 = peg$literalExpectation("$", false); + var peg$e163 = peg$literalExpectation("return", true); + var peg$e164 = peg$literalExpectation(":=", false); + var peg$e165 = peg$literalExpectation("session", true); + var peg$e166 = peg$literalExpectation("authorization", true); + var peg$e167 = peg$literalExpectation("search_path", true); + var peg$e168 = peg$literalExpectation("@", false); var peg$f0 = function() { return true; }; var peg$f1 = function(ast, tail) { @@ -1175,12 +1185,12 @@ function peg$parse(input, options) { var peg$f158 = function() { return 'NOT'; }; var peg$f159 = function() { return 'AND'; }; var peg$f160 = function() { return 'OR'; }; - var peg$f161 = function() { return 'COUNT'; }; - var peg$f162 = function() { return 'MAX'; }; - var peg$f163 = function() { return 'MIN'; }; - var peg$f164 = function() { return 'SUM'; }; - var peg$f165 = function() { return 'AVG'; }; - var peg$f166 = function(val) { return makeKeywordNode(val, location()) }; + var peg$f161 = function() { return 'TO'; }; + var peg$f162 = function() { return 'COUNT'; }; + var peg$f163 = function() { return 'MAX'; }; + var peg$f164 = function() { return 'MIN'; }; + var peg$f165 = function() { return 'SUM'; }; + var peg$f166 = function() { return 'AVG'; }; var peg$f167 = function(val) { return makeKeywordNode(val, location()) }; var peg$f168 = function(val) { return makeKeywordNode(val, location()) }; var peg$f169 = function(val) { return makeKeywordNode(val, location()) }; @@ -1193,32 +1203,33 @@ function peg$parse(input, options) { var peg$f176 = function(val) { return makeKeywordNode(val, location()) }; var peg$f177 = function(val) { return makeKeywordNode(val, location()) }; var peg$f178 = function(val) { return makeKeywordNode(val, location()) }; - var peg$f179 = function() { return true; }; - var peg$f180 = function(s) { + var peg$f179 = function(val) { return makeKeywordNode(val, location()) }; + var peg$f180 = function() { return true; }; + var peg$f181 = function(s) { return { stmt : s, } }; - var peg$f181 = function(va, e) { + var peg$f182 = function(va, e) { return { type : 'assign', left : va, right: e } }; - var peg$f182 = function(e) { + var peg$f183 = function(e) { return { type : 'return', expr: e } }; - var peg$f183 = function(head, tail) { + var peg$f184 = function(head, tail) { return createBinaryExprChain(head, tail); }; - var peg$f184 = function(head, tail) { + var peg$f185 = function(head, tail) { return createBinaryExprChain(head, tail); }; - var peg$f185 = function(lt, op, rt, expr) { + var peg$f186 = function(lt, op, rt, expr) { return { type : 'join', ltable : lt, @@ -1227,11 +1238,11 @@ function peg$parse(input, options) { on : expr } }; - var peg$f186 = function(e) { + var peg$f187 = function(e) { e.paren = true; return e; }; - var peg$f187 = function(name, l) { + var peg$f188 = function(name, l) { //compatible with original func_call return { type : 'function', @@ -1243,23 +1254,23 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f188 = function(value) { + var peg$f189 = function(value) { return { type : 'special_system_function', name : value, location: location(), } }; - var peg$f189 = function(head, tail) { + var peg$f190 = function(head, tail) { return createList(head, tail); }; - var peg$f190 = function(l) { + var peg$f191 = function(l) { return { type : 'array', value : l } }; - var peg$f191 = function(name, m) { + var peg$f192 = function(name, m) { return { type : 'var', name : name, @@ -1267,7 +1278,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f192 = function(name, m) { + var peg$f193 = function(name, m) { return { type : 'var_pg_promise', name : name, @@ -1275,14 +1286,14 @@ function peg$parse(input, options) { location: location() } }; - var peg$f193 = function(l) { + var peg$f194 = function(l) { var s = []; for (var i = 0; i < l.length; i++) { s.push(l[i][1]); } return s; }; - var peg$f194 = function(with_clause, val, t, w) { + var peg$f195 = function(with_clause, val, t, w) { return { type : 'delete', with : with_clause, @@ -1290,7 +1301,7 @@ function peg$parse(input, options) { where : w } }; - var peg$f195 = function(db, t) { + var peg$f196 = function(db, t) { return { type: 'table', db : db, @@ -1298,7 +1309,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f196 = function(t) { + var peg$f197 = function(t) { return { type: 'table', db : '', @@ -1306,7 +1317,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f197 = function(keyword, if_exists_keyword, table) { + var peg$f198 = function(keyword, if_exists_keyword, table) { return { type: 'drop_table', keyword: keyword, @@ -1314,7 +1325,7 @@ function peg$parse(input, options) { table: table } }; - var peg$f198 = function(keyword, table) { + var peg$f199 = function(keyword, table) { return { type: 'drop_table', keyword: keyword, @@ -1322,14 +1333,14 @@ function peg$parse(input, options) { table: table } }; - var peg$f199 = function(val) { + var peg$f200 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f200 = function(keyword, table, as, select) { + var peg$f201 = function(keyword, table, as, select) { return { type: 'create_table', keyword: keyword, @@ -1339,7 +1350,7 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f201 = function(keyword, if_not_exists_keyword, table, fields) { + var peg$f202 = function(keyword, if_not_exists_keyword, table, fields) { return { type: 'create_table', keyword: keyword, @@ -1349,7 +1360,7 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f202 = function(keyword, table, fields) { + var peg$f203 = function(keyword, table, fields) { return { type: 'create_table', if_not_exists: null, @@ -1359,24 +1370,24 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f203 = function(val) { + var peg$f204 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f204 = function(val) { + var peg$f205 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f205 = function(head, tail) { + var peg$f206 = function(head, tail) { return createList(head, tail); }; - var peg$f206 = function(name, type, constraints) { + var peg$f207 = function(name, type, constraints) { return { type: 'field', name: name, @@ -1385,7 +1396,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f207 = function(name, type) { + var peg$f208 = function(name, type) { return { type: 'field', name: name, @@ -1394,7 +1405,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f208 = function(k1, col_head, col_tail, k2, ref_table, ref_col_head, ref_col_tail, on) { + var peg$f209 = function(k1, col_head, col_tail, k2, ref_table, ref_col_head, ref_col_tail, on) { return { type: 'foreign_key', foreign_keyword: k1, @@ -1406,7 +1417,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f209 = function(on, trigger, action) { + var peg$f210 = function(on, trigger, action) { return { type: 'foreign_key_on', on_keyword: on, @@ -1415,7 +1426,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f210 = function(k, col_head, col_tail) { + var peg$f211 = function(k, col_head, col_tail) { return { type: 'primary_key', keyword: k, @@ -1423,7 +1434,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f211 = function(name, args_head, args_tail) { + var peg$f212 = function(name, args_head, args_tail) { return { type: 'field_data_type', name: name, @@ -1431,7 +1442,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f212 = function(name) { + var peg$f213 = function(name) { return { type: 'field_data_type', name: name, @@ -1439,50 +1450,47 @@ function peg$parse(input, options) { location: location() } }; - var peg$f213 = function(head, tail) { + var peg$f214 = function(head, tail) { return createList(head, tail, 1); }; - var peg$f214 = function(k) { + var peg$f215 = function(k) { return { type: 'constraint_not_null', keyword: k, location: location() } }; - var peg$f215 = function(k) { + var peg$f216 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f216 = function(k) { + var peg$f217 = function(k) { return { type: 'constraint_primary_key', keyword: k, location: location() } }; - var peg$f217 = function(k) { + var peg$f218 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f218 = function(k) { + var peg$f219 = function(k) { return { type: 'constraint_unique', keyword: k, location: location() } }; - var peg$f219 = function(k) { + var peg$f220 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f220 = function(k) { + var peg$f221 = function(k) { return { type: 'constraint_auto_increment', keyword: k, location: location() } }; - var peg$f221 = function(k) { + var peg$f222 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f222 = function(g, opt, data, seq) { + var peg$f223 = function(g, opt, data, seq) { return { type: 'constraint_generated', option: opt, data_type: data, sequence_options: seq } }; - var peg$f223 = function(k) { + var peg$f224 = function(k) { return { type: 'constraint_generated_option', option: 'ALWAYS', keyword: k } }; - var peg$f224 = function(k) { + var peg$f225 = function(k) { return { type: 'constraint_generated_option', option: 'BY_DEFAULT', keyword: k } }; - var peg$f225 = function(k) { + var peg$f226 = function(k) { return { type: 'constraint_generated_option', option: 'BY_DEFAULT_ON_NULL', keyword: k } }; - var peg$f226 = function(k, value) { + var peg$f227 = function(k, value) { return { type: 'constraint_default', keyword: k, value: value, location: location() } -}; - var peg$f227 = function(k) { - return { type: 'keyword', value: k && k[0], location: location() } }; var peg$f228 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } @@ -1490,49 +1498,52 @@ function peg$parse(input, options) { var peg$f229 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f230 = function(val) { + var peg$f230 = function(k) { + return { type: 'keyword', value: k && k[0], location: location() } +}; + var peg$f231 = function(val) { return { type: 'sequence_option_data_type', value: val, location: location() } }; - var peg$f231 = function(s) { + var peg$f232 = function(s) { return s[2] }; - var peg$f232 = function(head, tail) { + var peg$f233 = function(head, tail) { return createList(head, tail, 1); }; - var peg$f233 = function(val) { - return { type: 'sequence_option_increment', value: val, location: location() } -}; var peg$f234 = function(val) { return { type: 'sequence_option_increment', value: val, location: location() } }; var peg$f235 = function(val) { - return { type: 'sequence_option_maxvalue', value: val, location: location() } + return { type: 'sequence_option_increment', value: val, location: location() } }; var peg$f236 = function(val) { return { type: 'sequence_option_maxvalue', value: val, location: location() } }; - var peg$f237 = function() { - return { type: 'sequence_option_no_maxvalue', location: location() } + var peg$f237 = function(val) { + return { type: 'sequence_option_maxvalue', value: val, location: location() } }; var peg$f238 = function() { + return { type: 'sequence_option_no_maxvalue', location: location() } +}; + var peg$f239 = function() { return { type: 'sequence_option_no_minvalue', location: location() } }; - var peg$f239 = function(val) { + var peg$f240 = function(val) { return { type: 'sequence_option_cache', value: val, location: location() } }; - var peg$f240 = function() { + var peg$f241 = function() { return { type: 'sequence_option_cycle', location: location() } }; - var peg$f241 = function() { + var peg$f242 = function() { return { type: 'sequence_option_no_cycle', location: location() } }; - var peg$f242 = function(val) { + var peg$f243 = function(val) { return { type: 'sequence_option_owned_by', value: val, location: location() } }; - var peg$f243 = function() { + var peg$f244 = function() { return { type: 'sequence_option_owned_by_none', location: location() } }; - var peg$f244 = function(keyword, table, command) { + var peg$f245 = function(keyword, table, command) { return { type: 'alter_table', keyword: keyword, @@ -1540,14 +1551,14 @@ function peg$parse(input, options) { command: command } }; - var peg$f245 = function(val) { + var peg$f246 = function(val) { return { type: 'keyword', value: (val || []).map((v) => (v && v[0]) || [], []).join(''), location: location() } }; - var peg$f246 = function(keyword, field) { + var peg$f247 = function(keyword, field) { return { type: 'alter_table_add_column', keyword: keyword, @@ -1555,15 +1566,15 @@ function peg$parse(input, options) { location: location() } }; - var peg$f247 = function(val) { + var peg$f248 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f248 = function(keyword) {error('EXPECTED COLUMN NAME')}; - var peg$f249 = function(keyword, column) { + var peg$f249 = function(keyword) {error('EXPECTED COLUMN NAME')}; + var peg$f250 = function(keyword, column) { return { type: 'alter_table_drop_column', keyword: keyword, @@ -1571,15 +1582,15 @@ function peg$parse(input, options) { location: location() } }; - var peg$f250 = function(val) { + var peg$f251 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f251 = function(keyword) {error('EXPECTED COLUMN NAME')}; - var peg$f252 = function(keyword, field) { + var peg$f252 = function(keyword) {error('EXPECTED COLUMN NAME')}; + var peg$f253 = function(keyword, field) { return { type: 'alter_table_modify_column', keyword: keyword, @@ -1587,14 +1598,14 @@ function peg$parse(input, options) { location: location() } }; - var peg$f253 = function(val) { + var peg$f254 = function(val) { return { type: 'keyword', value: (val || []).map((v) => (v && v[0]) || [], []).join(''), location: location() } }; - var peg$f254 = function(val) { + var peg$f255 = function(val) { const ary = val || [] return { type: 'keyword', @@ -1602,14 +1613,14 @@ function peg$parse(input, options) { location: location() } }; - var peg$f255 = function(val) { + var peg$f256 = function(val) { return { type: 'keyword', value: (val || []).map((v) => (v && v[0]) || [], []).join(''), location: location() } }; - var peg$f256 = function(kw_create, kw_index, kw_if_not_exists, name, kw_on, table, columns) { + var peg$f257 = function(kw_create, kw_index, kw_if_not_exists, name, kw_on, table, columns) { return { type: 'create_index', create_keyword: kw_create, @@ -1623,7 +1634,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f257 = function(kw_create, kw_type, name, kw_as, fields) { + var peg$f258 = function(kw_create, kw_type, name, kw_as, fields) { return { type: 'create_type', type_variant: 'composite_type', @@ -1635,7 +1646,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f258 = function(name, type) { + var peg$f259 = function(name, type) { return { type: 'composite_type_field', name: name, @@ -1643,10 +1654,10 @@ function peg$parse(input, options) { location: location() } }; - var peg$f259 = function(head, tail) { + var peg$f260 = function(head, tail) { return createList(head, tail); }; - var peg$f260 = function(kw_create, kw_type, name, kw_as, kw_enum, values) { + var peg$f261 = function(kw_create, kw_type, name, kw_as, kw_enum, values) { return { type: 'create_type', type_variant: 'enum_type', @@ -1659,10 +1670,10 @@ function peg$parse(input, options) { location: location() } }; - var peg$f261 = function(head, tail) { + var peg$f262 = function(head, tail) { return createList(head, tail); }; - var peg$f262 = function(kw_create, kw_type, name, kw_as, kw_range, values) { + var peg$f263 = function(kw_create, kw_type, name, kw_as, kw_range, values) { return { type: 'create_type', type_variant: 'range_type', @@ -1675,7 +1686,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f263 = function(name, val) { + var peg$f264 = function(name, val) { if (val.type === 'number') { val = val.value } @@ -1686,7 +1697,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f264 = function(name) { + var peg$f265 = function(name) { return { type: 'assign_value_expr', name: name, @@ -1694,10 +1705,10 @@ function peg$parse(input, options) { location: location() } }; - var peg$f265 = function(head, tail) { + var peg$f266 = function(head, tail) { return createList(head, tail); }; - var peg$f266 = function(kw_create, kw_type, name, values) { + var peg$f267 = function(kw_create, kw_type, name, values) { return { type: 'create_type', type_variant: 'base_type', @@ -1708,7 +1719,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f267 = function(kw_drop, kw_type, kw_if_exists, names, dependency_action) { + var peg$f268 = function(kw_drop, kw_type, kw_if_exists, names, dependency_action) { return { type: 'drop_type', drop_keyword: kw_drop, @@ -1719,7 +1730,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f268 = function(keyword, if_exists_keyword, views, dependency_action) { + var peg$f269 = function(keyword, if_exists_keyword, views, dependency_action) { return { type: 'drop_view', keyword: keyword, @@ -1728,22 +1739,54 @@ function peg$parse(input, options) { dependency_action: dependency_action || null, } }; - var peg$f269 = function(head, tail) { + var peg$f270 = function(head, tail) { return createList(head, tail); }; - var peg$f270 = function(view) { + var peg$f271 = function(view) { return { type: 'view', value : view, } }; - var peg$f271 = function(val) { + var peg$f272 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; + var peg$f273 = function(assignments) { + return { + type: 'set', + assignments: assignments, + location: location() + } + }; + var peg$f274 = function(value) { + return { + type: 'session_authorization', + value: value, + location: location() + } + }; + var peg$f275 = function(name, head, tail) { + return { + type: 'search_path', + value: createList(head, tail), + location: location() + } + }; + var peg$f276 = function(head, tail) { + return createList(head, tail) + }; + var peg$f277 = function(name, value) { + return { + type: 'variable', + name: name[1], + value: value, + location: location() + } + }; var peg$currPos = 0; var peg$savedPos = 0; var peg$posDetailsCache = [{ line: 1, column: 1 }]; @@ -2007,6 +2050,9 @@ function peg$parse(input, options) { s0 = peg$parsecreate_type_stmt(); if (s0 === peg$FAILED) { s0 = peg$parsedrop_type_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseset_stmt(); + } } } } @@ -9602,13 +9648,13 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_COUNT() { + function peg$parseKW_TO() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c108) { - s1 = input.substr(peg$currPos, 5); - peg$currPos += 5; + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c108) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e125); } @@ -9639,13 +9685,13 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_MAX() { + function peg$parseKW_COUNT() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c109) { - s1 = input.substr(peg$currPos, 3); - peg$currPos += 3; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c109) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e126); } @@ -9676,7 +9722,7 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_MIN() { + function peg$parseKW_MAX() { var s0, s1, s2, s3; s0 = peg$currPos; @@ -9713,7 +9759,7 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_SUM() { + function peg$parseKW_MIN() { var s0, s1, s2, s3; s0 = peg$currPos; @@ -9750,7 +9796,7 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_AVG() { + function peg$parseKW_SUM() { var s0, s1, s2, s3; s0 = peg$currPos; @@ -9787,16 +9833,53 @@ function peg$parse(input, options) { return s0; } + function peg$parseKW_AVG() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c113) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e130); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f166(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + function peg$parseKW_CAST() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c113) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c114) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e130); } + if (peg$silentFails === 0) { peg$fail(peg$e131); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9811,7 +9894,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f166(s1); + s0 = peg$f167(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9828,12 +9911,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c114) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c115) { s1 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e131); } + if (peg$silentFails === 0) { peg$fail(peg$e132); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9848,7 +9931,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f167(s1); + s0 = peg$f168(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9865,12 +9948,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c115) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c116) { s1 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e132); } + if (peg$silentFails === 0) { peg$fail(peg$e133); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9885,7 +9968,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f168(s1); + s0 = peg$f169(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9902,12 +9985,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 10).toLowerCase() === peg$c116) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c117) { s1 = input.substr(peg$currPos, 10); peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e133); } + if (peg$silentFails === 0) { peg$fail(peg$e134); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9922,7 +10005,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f169(s1); + s0 = peg$f170(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9939,12 +10022,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c117) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c118) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e134); } + if (peg$silentFails === 0) { peg$fail(peg$e135); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9959,7 +10042,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f170(s1); + s0 = peg$f171(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9976,12 +10059,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c118) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c119) { s1 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e135); } + if (peg$silentFails === 0) { peg$fail(peg$e136); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9996,7 +10079,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f171(s1); + s0 = peg$f172(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10013,12 +10096,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c119) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c120) { s1 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e136); } + if (peg$silentFails === 0) { peg$fail(peg$e137); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10033,7 +10116,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f172(s1); + s0 = peg$f173(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10050,12 +10133,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c120) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c121) { s1 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e137); } + if (peg$silentFails === 0) { peg$fail(peg$e138); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10070,7 +10153,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f173(s1); + s0 = peg$f174(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10087,12 +10170,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c121) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c122) { s1 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e138); } + if (peg$silentFails === 0) { peg$fail(peg$e139); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10107,7 +10190,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f174(s1); + s0 = peg$f175(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10124,12 +10207,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c122) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c123) { s1 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e139); } + if (peg$silentFails === 0) { peg$fail(peg$e140); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10144,7 +10227,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f175(s1); + s0 = peg$f176(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10161,12 +10244,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c123) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c124) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e140); } + if (peg$silentFails === 0) { peg$fail(peg$e141); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10181,7 +10264,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f176(s1); + s0 = peg$f177(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10198,12 +10281,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c124) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c125) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e141); } + if (peg$silentFails === 0) { peg$fail(peg$e142); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10218,7 +10301,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f177(s1); + s0 = peg$f178(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10235,12 +10318,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c125) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c126) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e142); } + if (peg$silentFails === 0) { peg$fail(peg$e143); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10255,7 +10338,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f178(s1); + s0 = peg$f179(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10342,11 +10425,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 91) { - s0 = peg$c126; + s0 = peg$c127; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e143); } + if (peg$silentFails === 0) { peg$fail(peg$e144); } } return s0; @@ -10356,11 +10439,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 93) { - s0 = peg$c127; + s0 = peg$c128; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e144); } + if (peg$silentFails === 0) { peg$fail(peg$e145); } } return s0; @@ -10370,11 +10453,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 123) { - s0 = peg$c128; + s0 = peg$c129; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e145); } + if (peg$silentFails === 0) { peg$fail(peg$e146); } } return s0; @@ -10384,11 +10467,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 125) { - s0 = peg$c129; + s0 = peg$c130; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e146); } + if (peg$silentFails === 0) { peg$fail(peg$e147); } } return s0; @@ -10449,7 +10532,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e147); } + if (peg$silentFails === 0) { peg$fail(peg$e148); } } return s0; @@ -10470,12 +10553,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c130) { - s1 = peg$c130; + if (input.substr(peg$currPos, 2) === peg$c131) { + s1 = peg$c131; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e148); } + if (peg$silentFails === 0) { peg$fail(peg$e149); } } if (s1 !== peg$FAILED) { s2 = []; @@ -10544,24 +10627,24 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c131) { - s1 = peg$c131; + if (input.substr(peg$currPos, 2) === peg$c132) { + s1 = peg$c132; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e149); } + if (peg$silentFails === 0) { peg$fail(peg$e150); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c132) { - s5 = peg$c132; + if (input.substr(peg$currPos, 2) === peg$c133) { + s5 = peg$c133; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e150); } + if (peg$silentFails === 0) { peg$fail(peg$e151); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -10588,12 +10671,12 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c132) { - s5 = peg$c132; + if (input.substr(peg$currPos, 2) === peg$c133) { + s5 = peg$c133; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e150); } + if (peg$silentFails === 0) { peg$fail(peg$e151); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -10616,12 +10699,12 @@ function peg$parse(input, options) { s3 = peg$FAILED; } } - if (input.substr(peg$currPos, 2) === peg$c132) { - s3 = peg$c132; + if (input.substr(peg$currPos, 2) === peg$c133) { + s3 = peg$c133; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e150); } + if (peg$silentFails === 0) { peg$fail(peg$e151); } } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; @@ -10697,11 +10780,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 59) { - s0 = peg$c133; + s0 = peg$c134; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e151); } + if (peg$silentFails === 0) { peg$fail(peg$e152); } } return s0; @@ -10725,7 +10808,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$f179(); + s1 = peg$f180(); if (s1) { s1 = undefined; } else { @@ -10739,7 +10822,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f180(s3); + s0 = peg$f181(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10765,7 +10848,7 @@ function peg$parse(input, options) { s5 = peg$parseproc_expr(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f181(s1, s5); + s0 = peg$f182(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10792,7 +10875,7 @@ function peg$parse(input, options) { s3 = peg$parseproc_expr(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f182(s3); + s0 = peg$f183(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10867,7 +10950,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f183(s1, s2); + s0 = peg$f184(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10921,7 +11004,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f184(s1, s2); + s0 = peg$f185(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10946,7 +11029,7 @@ function peg$parse(input, options) { s7 = peg$parseon_clause(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f185(s1, s3, s5, s7); + s0 = peg$f186(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10990,7 +11073,7 @@ function peg$parse(input, options) { s5 = peg$parseRPAREN(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f186(s3); + s0 = peg$f187(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11028,7 +11111,7 @@ function peg$parse(input, options) { s7 = peg$parseRPAREN(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f187(s1, s5); + s0 = peg$f188(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11054,12 +11137,12 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c134) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c135) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e152); } + if (peg$silentFails === 0) { peg$fail(peg$e153); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11085,12 +11168,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c135) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c136) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e153); } + if (peg$silentFails === 0) { peg$fail(peg$e154); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11116,12 +11199,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c136) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c137) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e154); } + if (peg$silentFails === 0) { peg$fail(peg$e155); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11147,12 +11230,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 17).toLowerCase() === peg$c137) { + if (input.substr(peg$currPos, 17).toLowerCase() === peg$c138) { s2 = input.substr(peg$currPos, 17); peg$currPos += 17; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e155); } + if (peg$silentFails === 0) { peg$fail(peg$e156); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11178,12 +11261,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c138) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c139) { s2 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e156); } + if (peg$silentFails === 0) { peg$fail(peg$e157); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11209,12 +11292,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 14).toLowerCase() === peg$c139) { + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c140) { s2 = input.substr(peg$currPos, 14); peg$currPos += 14; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e157); } + if (peg$silentFails === 0) { peg$fail(peg$e158); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11240,12 +11323,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c140) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c141) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e158); } + if (peg$silentFails === 0) { peg$fail(peg$e159); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11271,12 +11354,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c141) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c142) { s2 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e159); } + if (peg$silentFails === 0) { peg$fail(peg$e160); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11302,12 +11385,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c142) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c143) { s2 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e160); } + if (peg$silentFails === 0) { peg$fail(peg$e161); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11341,7 +11424,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f188(s1); + s1 = peg$f189(s1); } s0 = s1; @@ -11393,7 +11476,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f189(s1, s2); + s0 = peg$f190(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11415,7 +11498,7 @@ function peg$parse(input, options) { s5 = peg$parseRBRAKE(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f190(s3); + s0 = peg$f191(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11453,7 +11536,7 @@ function peg$parse(input, options) { if (s2 !== peg$FAILED) { s3 = peg$parsemem_chain(); peg$savedPos = s0; - s0 = peg$f191(s2, s3); + s0 = peg$f192(s2, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11480,7 +11563,7 @@ function peg$parse(input, options) { s5 = peg$parseRBRACE(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f192(s3, s4); + s0 = peg$f193(s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11552,7 +11635,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s1 = peg$f193(s1); + s1 = peg$f194(s1); s0 = s1; return s0; @@ -11562,11 +11645,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 36) { - s0 = peg$c143; + s0 = peg$c144; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e161); } + if (peg$silentFails === 0) { peg$fail(peg$e162); } } return s0; @@ -11575,12 +11658,12 @@ function peg$parse(input, options) { function peg$parseKW_RETURN() { var s0; - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c144) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c145) { s0 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e162); } + if (peg$silentFails === 0) { peg$fail(peg$e163); } } return s0; @@ -11589,12 +11672,12 @@ function peg$parse(input, options) { function peg$parseKW_ASSIGN() { var s0; - if (input.substr(peg$currPos, 2) === peg$c145) { - s0 = peg$c145; + if (input.substr(peg$currPos, 2) === peg$c146) { + s0 = peg$c146; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e163); } + if (peg$silentFails === 0) { peg$fail(peg$e164); } } return s0; @@ -11623,7 +11706,7 @@ function peg$parse(input, options) { s9 = null; } peg$savedPos = s0; - s0 = peg$f194(s1, s3, s7, s9); + s0 = peg$f195(s1, s3, s7, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11653,7 +11736,7 @@ function peg$parse(input, options) { s5 = peg$parsetable_name(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f195(s1, s5); + s0 = peg$f196(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11671,7 +11754,7 @@ function peg$parse(input, options) { s1 = peg$parsetable_name(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f196(s1); + s1 = peg$f197(s1); } s0 = s1; } @@ -11693,7 +11776,7 @@ function peg$parse(input, options) { if (s5 !== peg$FAILED) { s6 = peg$parse__(); peg$savedPos = s0; - s0 = peg$f197(s1, s3, s5); + s0 = peg$f198(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11715,7 +11798,7 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parse__(); peg$savedPos = s0; - s0 = peg$f198(s1, s3); + s0 = peg$f199(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11736,7 +11819,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_DROP_TABLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f199(s1); + s1 = peg$f200(s1); } s0 = s1; @@ -11759,7 +11842,7 @@ function peg$parse(input, options) { s7 = peg$parseselect_stmt(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f200(s1, s3, s5, s7); + s0 = peg$f201(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11796,7 +11879,7 @@ function peg$parse(input, options) { s11 = peg$parseRPAREN(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f201(s1, s3, s5, s9); + s0 = peg$f202(s1, s3, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11838,7 +11921,7 @@ function peg$parse(input, options) { s9 = peg$parseRPAREN(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f202(s1, s3, s7); + s0 = peg$f203(s1, s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11872,7 +11955,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_CREATE_TABLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f203(s1); + s1 = peg$f204(s1); } s0 = s1; @@ -11886,7 +11969,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_IF_NOT_EXISTS(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f204(s1); + s1 = peg$f205(s1); } s0 = s1; @@ -11952,7 +12035,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f205(s1, s2); + s0 = peg$f206(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11974,7 +12057,7 @@ function peg$parse(input, options) { s5 = peg$parsefield_constraint_list(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f206(s1, s3, s5); + s0 = peg$f207(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11995,7 +12078,7 @@ function peg$parse(input, options) { s3 = peg$parsefield_data_type(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f207(s1, s3); + s0 = peg$f208(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12121,7 +12204,7 @@ function peg$parse(input, options) { s21 = null; } peg$savedPos = s0; - s0 = peg$f208(s1, s5, s6, s10, s12, s16, s17, s21); + s0 = peg$f209(s1, s5, s6, s10, s12, s16, s17, s21); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12190,7 +12273,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f209(s1, s3, s5); + s0 = peg$f210(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12261,7 +12344,7 @@ function peg$parse(input, options) { s8 = peg$parseRPAREN(); if (s8 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f210(s1, s5, s6); + s0 = peg$f211(s1, s5, s6); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12336,7 +12419,7 @@ function peg$parse(input, options) { s8 = peg$parseRPAREN(); if (s8 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f211(s1, s5, s6); + s0 = peg$f212(s1, s5, s6); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12358,7 +12441,7 @@ function peg$parse(input, options) { s1 = peg$parseident(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f212(s1); + s1 = peg$f213(s1); } s0 = s1; } @@ -12397,7 +12480,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f213(s1, s2); + s0 = peg$f214(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12436,7 +12519,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_not_null(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f214(s1); + s1 = peg$f215(s1); } s0 = s1; @@ -12450,7 +12533,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NOT_NULL(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f215(s1); + s1 = peg$f216(s1); } s0 = s1; @@ -12464,7 +12547,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_primary_key(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f216(s1); + s1 = peg$f217(s1); } s0 = s1; @@ -12478,7 +12561,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_PRIMARY_KEY(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f217(s1); + s1 = peg$f218(s1); } s0 = s1; @@ -12492,7 +12575,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_unique(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f218(s1); + s1 = peg$f219(s1); } s0 = s1; @@ -12506,7 +12589,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_UNIQUE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f219(s1); + s1 = peg$f220(s1); } s0 = s1; @@ -12520,7 +12603,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_auto_increment(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f220(s1); + s1 = peg$f221(s1); } s0 = s1; @@ -12534,7 +12617,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_AUTO_INCREMENT(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f221(s1); + s1 = peg$f222(s1); } s0 = s1; @@ -12561,7 +12644,7 @@ function peg$parse(input, options) { s7 = null; } peg$savedPos = s0; - s0 = peg$f222(s1, s3, s5, s7); + s0 = peg$f223(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12581,7 +12664,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_always(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f223(s1); + s1 = peg$f224(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -12589,7 +12672,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_by_default(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f224(s1); + s1 = peg$f225(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -12597,7 +12680,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_by_default_on_null(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f225(s1); + s1 = peg$f226(s1); } s0 = s1; } @@ -12622,7 +12705,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f226(s1, s3); + s0 = peg$f227(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12642,7 +12725,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_ALWAYS(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f227(s1); + s1 = peg$f228(s1); } s0 = s1; @@ -12656,7 +12739,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_BY_DEFAULT(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f228(s1); + s1 = peg$f229(s1); } s0 = s1; @@ -12670,7 +12753,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_BY_DEFAULT_ON_NULL(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f229(s1); + s1 = peg$f230(s1); } s0 = s1; @@ -12687,7 +12770,7 @@ function peg$parse(input, options) { s3 = peg$parseident(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f230(s3); + s0 = peg$f231(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12731,7 +12814,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f231(s1); + s1 = peg$f232(s1); } s0 = s1; } @@ -12770,7 +12853,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f232(s1, s2); + s0 = peg$f233(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12830,7 +12913,7 @@ function peg$parse(input, options) { s5 = peg$parseint(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f233(s5); + s0 = peg$f234(s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12860,7 +12943,7 @@ function peg$parse(input, options) { s5 = peg$parseint(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f234(s5); + s0 = peg$f235(s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12887,7 +12970,7 @@ function peg$parse(input, options) { s3 = peg$parseint(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f235(s3); + s0 = peg$f236(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12910,7 +12993,7 @@ function peg$parse(input, options) { s3 = peg$parseint(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f236(s3); + s0 = peg$f237(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12930,7 +13013,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NO_MAXVALUE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f237(); + s1 = peg$f238(); } s0 = s1; @@ -12944,7 +13027,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NO_MINVALUE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f238(); + s1 = peg$f239(); } s0 = s1; @@ -12961,7 +13044,7 @@ function peg$parse(input, options) { s3 = peg$parseint(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f239(s3); + s0 = peg$f240(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12981,7 +13064,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_CYCLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f240(); + s1 = peg$f241(); } s0 = s1; @@ -12995,7 +13078,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NO_CYCLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f241(); + s1 = peg$f242(); } s0 = s1; @@ -13012,7 +13095,7 @@ function peg$parse(input, options) { s3 = peg$parsecolumn_ref(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f242(s3); + s0 = peg$f243(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13032,7 +13115,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_OWNED_BY_NONE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f243(); + s1 = peg$f244(); } s0 = s1; @@ -13058,7 +13141,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f244(s1, s3, s5); + s0 = peg$f245(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13097,7 +13180,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f245(s1); + s1 = peg$f246(s1); } s0 = s1; @@ -13114,7 +13197,7 @@ function peg$parse(input, options) { s3 = peg$parsefield(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f246(s1, s3); + s0 = peg$f247(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13134,7 +13217,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_ADD(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f247(s1); + s1 = peg$f248(s1); } s0 = s1; @@ -13151,7 +13234,7 @@ function peg$parse(input, options) { s3 = peg$parsecolumn_node(); if (s3 === peg$FAILED) { peg$savedPos = peg$currPos; - s3 = peg$f248(s1); + s3 = peg$f249(s1); if (s3) { s3 = peg$FAILED; } else { @@ -13160,7 +13243,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f249(s1, s3); + s0 = peg$f250(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13180,7 +13263,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_DROP_COLUMN(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f250(s1); + s1 = peg$f251(s1); } s0 = s1; @@ -13197,7 +13280,7 @@ function peg$parse(input, options) { s3 = peg$parsefield(); if (s3 === peg$FAILED) { peg$savedPos = peg$currPos; - s3 = peg$f251(s1); + s3 = peg$f252(s1); if (s3) { s3 = peg$FAILED; } else { @@ -13206,7 +13289,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f252(s1, s3); + s0 = peg$f253(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13241,7 +13324,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f253(s1); + s1 = peg$f254(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -13249,7 +13332,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_MODIFY(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f254(s1); + s1 = peg$f255(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -13272,7 +13355,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f255(s1); + s1 = peg$f256(s1); } s0 = s1; } @@ -13314,7 +13397,7 @@ function peg$parse(input, options) { s17 = peg$parseRPAREN(); if (s17 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f256(s1, s3, s5, s7, s9, s11, s15); + s0 = peg$f257(s1, s3, s5, s7, s9, s11, s15); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13393,7 +13476,7 @@ function peg$parse(input, options) { s13 = peg$parseRPAREN(); if (s13 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f257(s1, s3, s5, s7, s11); + s0 = peg$f258(s1, s3, s5, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13436,7 +13519,7 @@ function peg$parse(input, options) { s3 = peg$parsefield_data_type(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f258(s1, s3); + s0 = peg$f259(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13494,7 +13577,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f259(s1, s2); + s0 = peg$f260(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13531,7 +13614,7 @@ function peg$parse(input, options) { s15 = peg$parseRPAREN(); if (s15 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f260(s1, s3, s5, s7, s9, s13); + s0 = peg$f261(s1, s3, s5, s7, s9, s13); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13613,7 +13696,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f261(s1, s2); + s0 = peg$f262(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13650,7 +13733,7 @@ function peg$parse(input, options) { s15 = peg$parseRPAREN(); if (s15 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f262(s1, s3, s5, s7, s9, s13); + s0 = peg$f263(s1, s3, s5, s7, s9, s13); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13709,7 +13792,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f263(s1, s5); + s0 = peg$f264(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13727,7 +13810,7 @@ function peg$parse(input, options) { s1 = peg$parseident(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f264(s1); + s1 = peg$f265(s1); } s0 = s1; } @@ -13780,7 +13863,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f265(s1, s2); + s0 = peg$f266(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13829,7 +13912,7 @@ function peg$parse(input, options) { s7 = null; } peg$savedPos = s0; - s0 = peg$f266(s1, s3, s5, s7); + s0 = peg$f267(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13872,7 +13955,7 @@ function peg$parse(input, options) { s9 = null; } peg$savedPos = s0; - s0 = peg$f267(s1, s3, s5, s7, s9); + s0 = peg$f268(s1, s3, s5, s7, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13912,7 +13995,7 @@ function peg$parse(input, options) { s7 = null; } peg$savedPos = s0; - s0 = peg$f268(s1, s3, s5, s7); + s0 = peg$f269(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13970,7 +14053,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f269(s1, s2); + s0 = peg$f270(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13986,7 +14069,7 @@ function peg$parse(input, options) { s1 = peg$parseident(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f270(s1); + s1 = peg$f271(s1); } s0 = s1; @@ -14000,13 +14083,296 @@ function peg$parse(input, options) { s1 = peg$parseKW_DROP_VIEW(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f271(s1); + s1 = peg$f272(s1); } s0 = s1; return s0; } + function peg$parseset_stmt() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_SET(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsesession_authorization_assignment(); + if (s3 === peg$FAILED) { + s3 = peg$parsesearch_path_assignment(); + if (s3 === peg$FAILED) { + s3 = peg$parsevariable_assignment_list(); + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f273(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsesession_authorization_assignment() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c147) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e165); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 13).toLowerCase() === peg$c148) { + s3 = input.substr(peg$currPos, 13); + peg$currPos += 13; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e166); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_TO(); + if (s5 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s5 = peg$c4; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseliteral_string(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f274(s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsesearch_path_assignment() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c149) { + s1 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e167); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TO(); + if (s3 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c4; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseliteral_string(); + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$currPos; + s8 = peg$parse__(); + s9 = peg$parseCOMMA(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseliteral_string(); + if (s11 !== peg$FAILED) { + s8 = [s8, s9, s10, s11]; + s7 = s8; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$currPos; + s8 = peg$parse__(); + s9 = peg$parseCOMMA(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseliteral_string(); + if (s11 !== peg$FAILED) { + s8 = [s8, s9, s10, s11]; + s7 = s8; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f275(s1, s5, s6); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsevariable_assignment_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsevariable_assignment(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevariable_assignment(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevariable_assignment(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f276(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsevariable_assignment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 64) { + s2 = peg$c150; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e168); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseident_name(); + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c4; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseliteral(); + if (s5 === peg$FAILED) { + s5 = peg$parseor_expr(); + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f277(s1, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + var reservedMap = module.exports.reservedMap || {}; diff --git a/packages/sql-parser/base/parser.js b/packages/sql-parser/base/parser.js index 469a31b7..3039a5b3 100644 --- a/packages/sql-parser/base/parser.js +++ b/packages/sql-parser/base/parser.js @@ -284,44 +284,49 @@ function peg$parse(input, options) { var peg$c105 = "not"; var peg$c106 = "and"; var peg$c107 = "or"; - var peg$c108 = "count"; - var peg$c109 = "max"; - var peg$c110 = "min"; - var peg$c111 = "sum"; - var peg$c112 = "avg"; - var peg$c113 = "cast"; - var peg$c114 = "recursive"; - var peg$c115 = "foreign key"; - var peg$c116 = "references"; - var peg$c117 = "index"; - var peg$c118 = "cascade"; - var peg$c119 = "set null"; - var peg$c120 = "set default"; - var peg$c121 = "restrict"; - var peg$c122 = "no action"; - var peg$c123 = "type"; - var peg$c124 = "enum"; - var peg$c125 = "range"; - var peg$c126 = "["; - var peg$c127 = "]"; - var peg$c128 = "{"; - var peg$c129 = "}"; - var peg$c130 = "--"; - var peg$c131 = "/*"; - var peg$c132 = "*/"; - var peg$c133 = ";"; - var peg$c134 = "current_user"; - var peg$c135 = "current_date"; - var peg$c136 = "current_time"; - var peg$c137 = "current_timestamp"; - var peg$c138 = "localtime"; - var peg$c139 = "localtimestamp"; - var peg$c140 = "session_user"; - var peg$c141 = "system_user"; - var peg$c142 = "user"; - var peg$c143 = "$"; - var peg$c144 = "return"; - var peg$c145 = ":="; + var peg$c108 = "to"; + var peg$c109 = "count"; + var peg$c110 = "max"; + var peg$c111 = "min"; + var peg$c112 = "sum"; + var peg$c113 = "avg"; + var peg$c114 = "cast"; + var peg$c115 = "recursive"; + var peg$c116 = "foreign key"; + var peg$c117 = "references"; + var peg$c118 = "index"; + var peg$c119 = "cascade"; + var peg$c120 = "set null"; + var peg$c121 = "set default"; + var peg$c122 = "restrict"; + var peg$c123 = "no action"; + var peg$c124 = "type"; + var peg$c125 = "enum"; + var peg$c126 = "range"; + var peg$c127 = "["; + var peg$c128 = "]"; + var peg$c129 = "{"; + var peg$c130 = "}"; + var peg$c131 = "--"; + var peg$c132 = "/*"; + var peg$c133 = "*/"; + var peg$c134 = ";"; + var peg$c135 = "current_user"; + var peg$c136 = "current_date"; + var peg$c137 = "current_time"; + var peg$c138 = "current_timestamp"; + var peg$c139 = "localtime"; + var peg$c140 = "localtimestamp"; + var peg$c141 = "session_user"; + var peg$c142 = "system_user"; + var peg$c143 = "user"; + var peg$c144 = "$"; + var peg$c145 = "return"; + var peg$c146 = ":="; + var peg$c147 = "session"; + var peg$c148 = "authorization"; + var peg$c149 = "search_path"; + var peg$c150 = "@"; var peg$r0 = /^[^)]/; var peg$r1 = /^[^`]/; @@ -466,45 +471,50 @@ function peg$parse(input, options) { var peg$e122 = peg$literalExpectation("NOT", true); var peg$e123 = peg$literalExpectation("AND", true); var peg$e124 = peg$literalExpectation("OR", true); - var peg$e125 = peg$literalExpectation("COUNT", true); - var peg$e126 = peg$literalExpectation("MAX", true); - var peg$e127 = peg$literalExpectation("MIN", true); - var peg$e128 = peg$literalExpectation("SUM", true); - var peg$e129 = peg$literalExpectation("AVG", true); - var peg$e130 = peg$literalExpectation("CAST", true); - var peg$e131 = peg$literalExpectation("RECURSIVE", true); - var peg$e132 = peg$literalExpectation("FOREIGN KEY", true); - var peg$e133 = peg$literalExpectation("REFERENCES", true); - var peg$e134 = peg$literalExpectation("INDEX", true); - var peg$e135 = peg$literalExpectation("CASCADE", true); - var peg$e136 = peg$literalExpectation("SET NULL", true); - var peg$e137 = peg$literalExpectation("SET DEFAULT", true); - var peg$e138 = peg$literalExpectation("RESTRICT", true); - var peg$e139 = peg$literalExpectation("NO ACTION", true); - var peg$e140 = peg$literalExpectation("TYPE", true); - var peg$e141 = peg$literalExpectation("ENUM", true); - var peg$e142 = peg$literalExpectation("RANGE", true); - var peg$e143 = peg$literalExpectation("[", false); - var peg$e144 = peg$literalExpectation("]", false); - var peg$e145 = peg$literalExpectation("{", false); - var peg$e146 = peg$literalExpectation("}", false); - var peg$e147 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); - var peg$e148 = peg$literalExpectation("--", false); - var peg$e149 = peg$literalExpectation("/*", false); - var peg$e150 = peg$literalExpectation("*/", false); - var peg$e151 = peg$literalExpectation(";", false); - var peg$e152 = peg$literalExpectation("CURRENT_USER", true); - var peg$e153 = peg$literalExpectation("CURRENT_DATE", true); - var peg$e154 = peg$literalExpectation("CURRENT_TIME", true); - var peg$e155 = peg$literalExpectation("CURRENT_TIMESTAMP", true); - var peg$e156 = peg$literalExpectation("LOCALTIME", true); - var peg$e157 = peg$literalExpectation("LOCALTIMESTAMP", true); - var peg$e158 = peg$literalExpectation("SESSION_USER", true); - var peg$e159 = peg$literalExpectation("SYSTEM_USER", true); - var peg$e160 = peg$literalExpectation("USER", true); - var peg$e161 = peg$literalExpectation("$", false); - var peg$e162 = peg$literalExpectation("return", true); - var peg$e163 = peg$literalExpectation(":=", false); + var peg$e125 = peg$literalExpectation("TO", true); + var peg$e126 = peg$literalExpectation("COUNT", true); + var peg$e127 = peg$literalExpectation("MAX", true); + var peg$e128 = peg$literalExpectation("MIN", true); + var peg$e129 = peg$literalExpectation("SUM", true); + var peg$e130 = peg$literalExpectation("AVG", true); + var peg$e131 = peg$literalExpectation("CAST", true); + var peg$e132 = peg$literalExpectation("RECURSIVE", true); + var peg$e133 = peg$literalExpectation("FOREIGN KEY", true); + var peg$e134 = peg$literalExpectation("REFERENCES", true); + var peg$e135 = peg$literalExpectation("INDEX", true); + var peg$e136 = peg$literalExpectation("CASCADE", true); + var peg$e137 = peg$literalExpectation("SET NULL", true); + var peg$e138 = peg$literalExpectation("SET DEFAULT", true); + var peg$e139 = peg$literalExpectation("RESTRICT", true); + var peg$e140 = peg$literalExpectation("NO ACTION", true); + var peg$e141 = peg$literalExpectation("TYPE", true); + var peg$e142 = peg$literalExpectation("ENUM", true); + var peg$e143 = peg$literalExpectation("RANGE", true); + var peg$e144 = peg$literalExpectation("[", false); + var peg$e145 = peg$literalExpectation("]", false); + var peg$e146 = peg$literalExpectation("{", false); + var peg$e147 = peg$literalExpectation("}", false); + var peg$e148 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); + var peg$e149 = peg$literalExpectation("--", false); + var peg$e150 = peg$literalExpectation("/*", false); + var peg$e151 = peg$literalExpectation("*/", false); + var peg$e152 = peg$literalExpectation(";", false); + var peg$e153 = peg$literalExpectation("CURRENT_USER", true); + var peg$e154 = peg$literalExpectation("CURRENT_DATE", true); + var peg$e155 = peg$literalExpectation("CURRENT_TIME", true); + var peg$e156 = peg$literalExpectation("CURRENT_TIMESTAMP", true); + var peg$e157 = peg$literalExpectation("LOCALTIME", true); + var peg$e158 = peg$literalExpectation("LOCALTIMESTAMP", true); + var peg$e159 = peg$literalExpectation("SESSION_USER", true); + var peg$e160 = peg$literalExpectation("SYSTEM_USER", true); + var peg$e161 = peg$literalExpectation("USER", true); + var peg$e162 = peg$literalExpectation("$", false); + var peg$e163 = peg$literalExpectation("return", true); + var peg$e164 = peg$literalExpectation(":=", false); + var peg$e165 = peg$literalExpectation("session", true); + var peg$e166 = peg$literalExpectation("authorization", true); + var peg$e167 = peg$literalExpectation("search_path", true); + var peg$e168 = peg$literalExpectation("@", false); var peg$f0 = function() { return true; }; var peg$f1 = function(ast, tail) { @@ -1175,12 +1185,12 @@ function peg$parse(input, options) { var peg$f158 = function() { return 'NOT'; }; var peg$f159 = function() { return 'AND'; }; var peg$f160 = function() { return 'OR'; }; - var peg$f161 = function() { return 'COUNT'; }; - var peg$f162 = function() { return 'MAX'; }; - var peg$f163 = function() { return 'MIN'; }; - var peg$f164 = function() { return 'SUM'; }; - var peg$f165 = function() { return 'AVG'; }; - var peg$f166 = function(val) { return makeKeywordNode(val, location()) }; + var peg$f161 = function() { return 'TO'; }; + var peg$f162 = function() { return 'COUNT'; }; + var peg$f163 = function() { return 'MAX'; }; + var peg$f164 = function() { return 'MIN'; }; + var peg$f165 = function() { return 'SUM'; }; + var peg$f166 = function() { return 'AVG'; }; var peg$f167 = function(val) { return makeKeywordNode(val, location()) }; var peg$f168 = function(val) { return makeKeywordNode(val, location()) }; var peg$f169 = function(val) { return makeKeywordNode(val, location()) }; @@ -1193,32 +1203,33 @@ function peg$parse(input, options) { var peg$f176 = function(val) { return makeKeywordNode(val, location()) }; var peg$f177 = function(val) { return makeKeywordNode(val, location()) }; var peg$f178 = function(val) { return makeKeywordNode(val, location()) }; - var peg$f179 = function() { return true; }; - var peg$f180 = function(s) { + var peg$f179 = function(val) { return makeKeywordNode(val, location()) }; + var peg$f180 = function() { return true; }; + var peg$f181 = function(s) { return { stmt : s, } }; - var peg$f181 = function(va, e) { + var peg$f182 = function(va, e) { return { type : 'assign', left : va, right: e } }; - var peg$f182 = function(e) { + var peg$f183 = function(e) { return { type : 'return', expr: e } }; - var peg$f183 = function(head, tail) { + var peg$f184 = function(head, tail) { return createBinaryExprChain(head, tail); }; - var peg$f184 = function(head, tail) { + var peg$f185 = function(head, tail) { return createBinaryExprChain(head, tail); }; - var peg$f185 = function(lt, op, rt, expr) { + var peg$f186 = function(lt, op, rt, expr) { return { type : 'join', ltable : lt, @@ -1227,11 +1238,11 @@ function peg$parse(input, options) { on : expr } }; - var peg$f186 = function(e) { + var peg$f187 = function(e) { e.paren = true; return e; }; - var peg$f187 = function(name, l) { + var peg$f188 = function(name, l) { //compatible with original func_call return { type : 'function', @@ -1243,23 +1254,23 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f188 = function(value) { + var peg$f189 = function(value) { return { type : 'special_system_function', name : value, location: location(), } }; - var peg$f189 = function(head, tail) { + var peg$f190 = function(head, tail) { return createList(head, tail); }; - var peg$f190 = function(l) { + var peg$f191 = function(l) { return { type : 'array', value : l } }; - var peg$f191 = function(name, m) { + var peg$f192 = function(name, m) { return { type : 'var', name : name, @@ -1267,7 +1278,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f192 = function(name, m) { + var peg$f193 = function(name, m) { return { type : 'var_pg_promise', name : name, @@ -1275,14 +1286,14 @@ function peg$parse(input, options) { location: location() } }; - var peg$f193 = function(l) { + var peg$f194 = function(l) { var s = []; for (var i = 0; i < l.length; i++) { s.push(l[i][1]); } return s; }; - var peg$f194 = function(with_clause, val, t, w) { + var peg$f195 = function(with_clause, val, t, w) { return { type : 'delete', with : with_clause, @@ -1290,7 +1301,7 @@ function peg$parse(input, options) { where : w } }; - var peg$f195 = function(db, t) { + var peg$f196 = function(db, t) { return { type: 'table', db : db, @@ -1298,7 +1309,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f196 = function(t) { + var peg$f197 = function(t) { return { type: 'table', db : '', @@ -1306,7 +1317,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f197 = function(keyword, if_exists_keyword, table) { + var peg$f198 = function(keyword, if_exists_keyword, table) { return { type: 'drop_table', keyword: keyword, @@ -1314,7 +1325,7 @@ function peg$parse(input, options) { table: table } }; - var peg$f198 = function(keyword, table) { + var peg$f199 = function(keyword, table) { return { type: 'drop_table', keyword: keyword, @@ -1322,14 +1333,14 @@ function peg$parse(input, options) { table: table } }; - var peg$f199 = function(val) { + var peg$f200 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f200 = function(keyword, table, as, select) { + var peg$f201 = function(keyword, table, as, select) { return { type: 'create_table', keyword: keyword, @@ -1339,7 +1350,7 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f201 = function(keyword, if_not_exists_keyword, table, fields) { + var peg$f202 = function(keyword, if_not_exists_keyword, table, fields) { return { type: 'create_table', keyword: keyword, @@ -1349,7 +1360,7 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f202 = function(keyword, table, fields) { + var peg$f203 = function(keyword, table, fields) { return { type: 'create_table', if_not_exists: null, @@ -1359,24 +1370,24 @@ function peg$parse(input, options) { location: location(), } }; - var peg$f203 = function(val) { + var peg$f204 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f204 = function(val) { + var peg$f205 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f205 = function(head, tail) { + var peg$f206 = function(head, tail) { return createList(head, tail); }; - var peg$f206 = function(name, type, constraints) { + var peg$f207 = function(name, type, constraints) { return { type: 'field', name: name, @@ -1385,7 +1396,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f207 = function(name, type) { + var peg$f208 = function(name, type) { return { type: 'field', name: name, @@ -1394,7 +1405,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f208 = function(k1, col_head, col_tail, k2, ref_table, ref_col_head, ref_col_tail, on) { + var peg$f209 = function(k1, col_head, col_tail, k2, ref_table, ref_col_head, ref_col_tail, on) { return { type: 'foreign_key', foreign_keyword: k1, @@ -1406,7 +1417,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f209 = function(on, trigger, action) { + var peg$f210 = function(on, trigger, action) { return { type: 'foreign_key_on', on_keyword: on, @@ -1415,7 +1426,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f210 = function(k, col_head, col_tail) { + var peg$f211 = function(k, col_head, col_tail) { return { type: 'primary_key', keyword: k, @@ -1423,7 +1434,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f211 = function(name, args_head, args_tail) { + var peg$f212 = function(name, args_head, args_tail) { return { type: 'field_data_type', name: name, @@ -1431,7 +1442,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f212 = function(name) { + var peg$f213 = function(name) { return { type: 'field_data_type', name: name, @@ -1439,50 +1450,47 @@ function peg$parse(input, options) { location: location() } }; - var peg$f213 = function(head, tail) { + var peg$f214 = function(head, tail) { return createList(head, tail, 1); }; - var peg$f214 = function(k) { + var peg$f215 = function(k) { return { type: 'constraint_not_null', keyword: k, location: location() } }; - var peg$f215 = function(k) { + var peg$f216 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f216 = function(k) { + var peg$f217 = function(k) { return { type: 'constraint_primary_key', keyword: k, location: location() } }; - var peg$f217 = function(k) { + var peg$f218 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f218 = function(k) { + var peg$f219 = function(k) { return { type: 'constraint_unique', keyword: k, location: location() } }; - var peg$f219 = function(k) { + var peg$f220 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f220 = function(k) { + var peg$f221 = function(k) { return { type: 'constraint_auto_increment', keyword: k, location: location() } }; - var peg$f221 = function(k) { + var peg$f222 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f222 = function(g, opt, data, seq) { + var peg$f223 = function(g, opt, data, seq) { return { type: 'constraint_generated', option: opt, data_type: data, sequence_options: seq } }; - var peg$f223 = function(k) { + var peg$f224 = function(k) { return { type: 'constraint_generated_option', option: 'ALWAYS', keyword: k } }; - var peg$f224 = function(k) { + var peg$f225 = function(k) { return { type: 'constraint_generated_option', option: 'BY_DEFAULT', keyword: k } }; - var peg$f225 = function(k) { + var peg$f226 = function(k) { return { type: 'constraint_generated_option', option: 'BY_DEFAULT_ON_NULL', keyword: k } }; - var peg$f226 = function(k, value) { + var peg$f227 = function(k, value) { return { type: 'constraint_default', keyword: k, value: value, location: location() } -}; - var peg$f227 = function(k) { - return { type: 'keyword', value: k && k[0], location: location() } }; var peg$f228 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } @@ -1490,49 +1498,52 @@ function peg$parse(input, options) { var peg$f229 = function(k) { return { type: 'keyword', value: k && k[0], location: location() } }; - var peg$f230 = function(val) { + var peg$f230 = function(k) { + return { type: 'keyword', value: k && k[0], location: location() } +}; + var peg$f231 = function(val) { return { type: 'sequence_option_data_type', value: val, location: location() } }; - var peg$f231 = function(s) { + var peg$f232 = function(s) { return s[2] }; - var peg$f232 = function(head, tail) { + var peg$f233 = function(head, tail) { return createList(head, tail, 1); }; - var peg$f233 = function(val) { - return { type: 'sequence_option_increment', value: val, location: location() } -}; var peg$f234 = function(val) { return { type: 'sequence_option_increment', value: val, location: location() } }; var peg$f235 = function(val) { - return { type: 'sequence_option_maxvalue', value: val, location: location() } + return { type: 'sequence_option_increment', value: val, location: location() } }; var peg$f236 = function(val) { return { type: 'sequence_option_maxvalue', value: val, location: location() } }; - var peg$f237 = function() { - return { type: 'sequence_option_no_maxvalue', location: location() } + var peg$f237 = function(val) { + return { type: 'sequence_option_maxvalue', value: val, location: location() } }; var peg$f238 = function() { + return { type: 'sequence_option_no_maxvalue', location: location() } +}; + var peg$f239 = function() { return { type: 'sequence_option_no_minvalue', location: location() } }; - var peg$f239 = function(val) { + var peg$f240 = function(val) { return { type: 'sequence_option_cache', value: val, location: location() } }; - var peg$f240 = function() { + var peg$f241 = function() { return { type: 'sequence_option_cycle', location: location() } }; - var peg$f241 = function() { + var peg$f242 = function() { return { type: 'sequence_option_no_cycle', location: location() } }; - var peg$f242 = function(val) { + var peg$f243 = function(val) { return { type: 'sequence_option_owned_by', value: val, location: location() } }; - var peg$f243 = function() { + var peg$f244 = function() { return { type: 'sequence_option_owned_by_none', location: location() } }; - var peg$f244 = function(keyword, table, command) { + var peg$f245 = function(keyword, table, command) { return { type: 'alter_table', keyword: keyword, @@ -1540,14 +1551,14 @@ function peg$parse(input, options) { command: command } }; - var peg$f245 = function(val) { + var peg$f246 = function(val) { return { type: 'keyword', value: (val || []).map((v) => (v && v[0]) || [], []).join(''), location: location() } }; - var peg$f246 = function(keyword, field) { + var peg$f247 = function(keyword, field) { return { type: 'alter_table_add_column', keyword: keyword, @@ -1555,15 +1566,15 @@ function peg$parse(input, options) { location: location() } }; - var peg$f247 = function(val) { + var peg$f248 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f248 = function(keyword) {error('EXPECTED COLUMN NAME')}; - var peg$f249 = function(keyword, column) { + var peg$f249 = function(keyword) {error('EXPECTED COLUMN NAME')}; + var peg$f250 = function(keyword, column) { return { type: 'alter_table_drop_column', keyword: keyword, @@ -1571,15 +1582,15 @@ function peg$parse(input, options) { location: location() } }; - var peg$f250 = function(val) { + var peg$f251 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; - var peg$f251 = function(keyword) {error('EXPECTED COLUMN NAME')}; - var peg$f252 = function(keyword, field) { + var peg$f252 = function(keyword) {error('EXPECTED COLUMN NAME')}; + var peg$f253 = function(keyword, field) { return { type: 'alter_table_modify_column', keyword: keyword, @@ -1587,14 +1598,14 @@ function peg$parse(input, options) { location: location() } }; - var peg$f253 = function(val) { + var peg$f254 = function(val) { return { type: 'keyword', value: (val || []).map((v) => (v && v[0]) || [], []).join(''), location: location() } }; - var peg$f254 = function(val) { + var peg$f255 = function(val) { const ary = val || [] return { type: 'keyword', @@ -1602,14 +1613,14 @@ function peg$parse(input, options) { location: location() } }; - var peg$f255 = function(val) { + var peg$f256 = function(val) { return { type: 'keyword', value: (val || []).map((v) => (v && v[0]) || [], []).join(''), location: location() } }; - var peg$f256 = function(kw_create, kw_index, kw_if_not_exists, name, kw_on, table, columns) { + var peg$f257 = function(kw_create, kw_index, kw_if_not_exists, name, kw_on, table, columns) { return { type: 'create_index', create_keyword: kw_create, @@ -1623,7 +1634,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f257 = function(kw_create, kw_type, name, kw_as, fields) { + var peg$f258 = function(kw_create, kw_type, name, kw_as, fields) { return { type: 'create_type', type_variant: 'composite_type', @@ -1635,7 +1646,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f258 = function(name, type) { + var peg$f259 = function(name, type) { return { type: 'composite_type_field', name: name, @@ -1643,10 +1654,10 @@ function peg$parse(input, options) { location: location() } }; - var peg$f259 = function(head, tail) { + var peg$f260 = function(head, tail) { return createList(head, tail); }; - var peg$f260 = function(kw_create, kw_type, name, kw_as, kw_enum, values) { + var peg$f261 = function(kw_create, kw_type, name, kw_as, kw_enum, values) { return { type: 'create_type', type_variant: 'enum_type', @@ -1659,10 +1670,10 @@ function peg$parse(input, options) { location: location() } }; - var peg$f261 = function(head, tail) { + var peg$f262 = function(head, tail) { return createList(head, tail); }; - var peg$f262 = function(kw_create, kw_type, name, kw_as, kw_range, values) { + var peg$f263 = function(kw_create, kw_type, name, kw_as, kw_range, values) { return { type: 'create_type', type_variant: 'range_type', @@ -1675,7 +1686,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f263 = function(name, val) { + var peg$f264 = function(name, val) { if (val.type === 'number') { val = val.value } @@ -1686,7 +1697,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f264 = function(name) { + var peg$f265 = function(name) { return { type: 'assign_value_expr', name: name, @@ -1694,10 +1705,10 @@ function peg$parse(input, options) { location: location() } }; - var peg$f265 = function(head, tail) { + var peg$f266 = function(head, tail) { return createList(head, tail); }; - var peg$f266 = function(kw_create, kw_type, name, values) { + var peg$f267 = function(kw_create, kw_type, name, values) { return { type: 'create_type', type_variant: 'base_type', @@ -1708,7 +1719,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f267 = function(kw_drop, kw_type, kw_if_exists, names, dependency_action) { + var peg$f268 = function(kw_drop, kw_type, kw_if_exists, names, dependency_action) { return { type: 'drop_type', drop_keyword: kw_drop, @@ -1719,7 +1730,7 @@ function peg$parse(input, options) { location: location() } }; - var peg$f268 = function(keyword, if_exists_keyword, views, dependency_action) { + var peg$f269 = function(keyword, if_exists_keyword, views, dependency_action) { return { type: 'drop_view', keyword: keyword, @@ -1728,22 +1739,54 @@ function peg$parse(input, options) { dependency_action: dependency_action || null, } }; - var peg$f269 = function(head, tail) { + var peg$f270 = function(head, tail) { return createList(head, tail); }; - var peg$f270 = function(view) { + var peg$f271 = function(view) { return { type: 'view', value : view, } }; - var peg$f271 = function(val) { + var peg$f272 = function(val) { return { type: 'keyword', value: val && val[0], location: location() } }; + var peg$f273 = function(assignments) { + return { + type: 'set', + assignments: assignments, + location: location() + } + }; + var peg$f274 = function(value) { + return { + type: 'session_authorization', + value: value, + location: location() + } + }; + var peg$f275 = function(name, head, tail) { + return { + type: 'search_path', + value: createList(head, tail), + location: location() + } + }; + var peg$f276 = function(head, tail) { + return createList(head, tail) + }; + var peg$f277 = function(name, value) { + return { + type: 'variable', + name: name[1], + value: value, + location: location() + } + }; var peg$currPos = 0; var peg$savedPos = 0; var peg$posDetailsCache = [{ line: 1, column: 1 }]; @@ -2007,6 +2050,9 @@ function peg$parse(input, options) { s0 = peg$parsecreate_type_stmt(); if (s0 === peg$FAILED) { s0 = peg$parsedrop_type_stmt(); + if (s0 === peg$FAILED) { + s0 = peg$parseset_stmt(); + } } } } @@ -9602,13 +9648,13 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_COUNT() { + function peg$parseKW_TO() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c108) { - s1 = input.substr(peg$currPos, 5); - peg$currPos += 5; + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c108) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e125); } @@ -9639,13 +9685,13 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_MAX() { + function peg$parseKW_COUNT() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c109) { - s1 = input.substr(peg$currPos, 3); - peg$currPos += 3; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c109) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e126); } @@ -9676,7 +9722,7 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_MIN() { + function peg$parseKW_MAX() { var s0, s1, s2, s3; s0 = peg$currPos; @@ -9713,7 +9759,7 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_SUM() { + function peg$parseKW_MIN() { var s0, s1, s2, s3; s0 = peg$currPos; @@ -9750,7 +9796,7 @@ function peg$parse(input, options) { return s0; } - function peg$parseKW_AVG() { + function peg$parseKW_SUM() { var s0, s1, s2, s3; s0 = peg$currPos; @@ -9787,16 +9833,53 @@ function peg$parse(input, options) { return s0; } + function peg$parseKW_AVG() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c113) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e130); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseident_start(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = undefined; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f166(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + function peg$parseKW_CAST() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c113) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c114) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e130); } + if (peg$silentFails === 0) { peg$fail(peg$e131); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9811,7 +9894,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f166(s1); + s0 = peg$f167(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9828,12 +9911,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c114) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c115) { s1 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e131); } + if (peg$silentFails === 0) { peg$fail(peg$e132); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9848,7 +9931,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f167(s1); + s0 = peg$f168(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9865,12 +9948,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c115) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c116) { s1 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e132); } + if (peg$silentFails === 0) { peg$fail(peg$e133); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9885,7 +9968,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f168(s1); + s0 = peg$f169(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9902,12 +9985,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 10).toLowerCase() === peg$c116) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c117) { s1 = input.substr(peg$currPos, 10); peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e133); } + if (peg$silentFails === 0) { peg$fail(peg$e134); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9922,7 +10005,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f169(s1); + s0 = peg$f170(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9939,12 +10022,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c117) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c118) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e134); } + if (peg$silentFails === 0) { peg$fail(peg$e135); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9959,7 +10042,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f170(s1); + s0 = peg$f171(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -9976,12 +10059,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 7).toLowerCase() === peg$c118) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c119) { s1 = input.substr(peg$currPos, 7); peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e135); } + if (peg$silentFails === 0) { peg$fail(peg$e136); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -9996,7 +10079,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f171(s1); + s0 = peg$f172(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10013,12 +10096,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c119) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c120) { s1 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e136); } + if (peg$silentFails === 0) { peg$fail(peg$e137); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10033,7 +10116,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f172(s1); + s0 = peg$f173(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10050,12 +10133,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c120) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c121) { s1 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e137); } + if (peg$silentFails === 0) { peg$fail(peg$e138); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10070,7 +10153,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f173(s1); + s0 = peg$f174(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10087,12 +10170,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8).toLowerCase() === peg$c121) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c122) { s1 = input.substr(peg$currPos, 8); peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e138); } + if (peg$silentFails === 0) { peg$fail(peg$e139); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10107,7 +10190,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f174(s1); + s0 = peg$f175(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10124,12 +10207,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c122) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c123) { s1 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e139); } + if (peg$silentFails === 0) { peg$fail(peg$e140); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10144,7 +10227,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f175(s1); + s0 = peg$f176(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10161,12 +10244,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c123) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c124) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e140); } + if (peg$silentFails === 0) { peg$fail(peg$e141); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10181,7 +10264,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f176(s1); + s0 = peg$f177(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10198,12 +10281,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c124) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c125) { s1 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e141); } + if (peg$silentFails === 0) { peg$fail(peg$e142); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10218,7 +10301,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f177(s1); + s0 = peg$f178(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10235,12 +10318,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5).toLowerCase() === peg$c125) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c126) { s1 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e142); } + if (peg$silentFails === 0) { peg$fail(peg$e143); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -10255,7 +10338,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f178(s1); + s0 = peg$f179(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10342,11 +10425,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 91) { - s0 = peg$c126; + s0 = peg$c127; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e143); } + if (peg$silentFails === 0) { peg$fail(peg$e144); } } return s0; @@ -10356,11 +10439,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 93) { - s0 = peg$c127; + s0 = peg$c128; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e144); } + if (peg$silentFails === 0) { peg$fail(peg$e145); } } return s0; @@ -10370,11 +10453,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 123) { - s0 = peg$c128; + s0 = peg$c129; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e145); } + if (peg$silentFails === 0) { peg$fail(peg$e146); } } return s0; @@ -10384,11 +10467,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 125) { - s0 = peg$c129; + s0 = peg$c130; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e146); } + if (peg$silentFails === 0) { peg$fail(peg$e147); } } return s0; @@ -10449,7 +10532,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e147); } + if (peg$silentFails === 0) { peg$fail(peg$e148); } } return s0; @@ -10470,12 +10553,12 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c130) { - s1 = peg$c130; + if (input.substr(peg$currPos, 2) === peg$c131) { + s1 = peg$c131; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e148); } + if (peg$silentFails === 0) { peg$fail(peg$e149); } } if (s1 !== peg$FAILED) { s2 = []; @@ -10544,24 +10627,24 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c131) { - s1 = peg$c131; + if (input.substr(peg$currPos, 2) === peg$c132) { + s1 = peg$c132; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e149); } + if (peg$silentFails === 0) { peg$fail(peg$e150); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c132) { - s5 = peg$c132; + if (input.substr(peg$currPos, 2) === peg$c133) { + s5 = peg$c133; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e150); } + if (peg$silentFails === 0) { peg$fail(peg$e151); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -10588,12 +10671,12 @@ function peg$parse(input, options) { s3 = peg$currPos; s4 = peg$currPos; peg$silentFails++; - if (input.substr(peg$currPos, 2) === peg$c132) { - s5 = peg$c132; + if (input.substr(peg$currPos, 2) === peg$c133) { + s5 = peg$c133; peg$currPos += 2; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e150); } + if (peg$silentFails === 0) { peg$fail(peg$e151); } } peg$silentFails--; if (s5 === peg$FAILED) { @@ -10616,12 +10699,12 @@ function peg$parse(input, options) { s3 = peg$FAILED; } } - if (input.substr(peg$currPos, 2) === peg$c132) { - s3 = peg$c132; + if (input.substr(peg$currPos, 2) === peg$c133) { + s3 = peg$c133; peg$currPos += 2; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e150); } + if (peg$silentFails === 0) { peg$fail(peg$e151); } } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; @@ -10697,11 +10780,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 59) { - s0 = peg$c133; + s0 = peg$c134; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e151); } + if (peg$silentFails === 0) { peg$fail(peg$e152); } } return s0; @@ -10725,7 +10808,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$f179(); + s1 = peg$f180(); if (s1) { s1 = undefined; } else { @@ -10739,7 +10822,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f180(s3); + s0 = peg$f181(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10765,7 +10848,7 @@ function peg$parse(input, options) { s5 = peg$parseproc_expr(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f181(s1, s5); + s0 = peg$f182(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10792,7 +10875,7 @@ function peg$parse(input, options) { s3 = peg$parseproc_expr(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f182(s3); + s0 = peg$f183(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10867,7 +10950,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f183(s1, s2); + s0 = peg$f184(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10921,7 +11004,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f184(s1, s2); + s0 = peg$f185(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10946,7 +11029,7 @@ function peg$parse(input, options) { s7 = peg$parseon_clause(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f185(s1, s3, s5, s7); + s0 = peg$f186(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -10990,7 +11073,7 @@ function peg$parse(input, options) { s5 = peg$parseRPAREN(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f186(s3); + s0 = peg$f187(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11028,7 +11111,7 @@ function peg$parse(input, options) { s7 = peg$parseRPAREN(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f187(s1, s5); + s0 = peg$f188(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11054,12 +11137,12 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c134) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c135) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e152); } + if (peg$silentFails === 0) { peg$fail(peg$e153); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11085,12 +11168,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c135) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c136) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e153); } + if (peg$silentFails === 0) { peg$fail(peg$e154); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11116,12 +11199,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c136) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c137) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e154); } + if (peg$silentFails === 0) { peg$fail(peg$e155); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11147,12 +11230,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 17).toLowerCase() === peg$c137) { + if (input.substr(peg$currPos, 17).toLowerCase() === peg$c138) { s2 = input.substr(peg$currPos, 17); peg$currPos += 17; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e155); } + if (peg$silentFails === 0) { peg$fail(peg$e156); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11178,12 +11261,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 9).toLowerCase() === peg$c138) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c139) { s2 = input.substr(peg$currPos, 9); peg$currPos += 9; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e156); } + if (peg$silentFails === 0) { peg$fail(peg$e157); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11209,12 +11292,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 14).toLowerCase() === peg$c139) { + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c140) { s2 = input.substr(peg$currPos, 14); peg$currPos += 14; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e157); } + if (peg$silentFails === 0) { peg$fail(peg$e158); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11240,12 +11323,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 12).toLowerCase() === peg$c140) { + if (input.substr(peg$currPos, 12).toLowerCase() === peg$c141) { s2 = input.substr(peg$currPos, 12); peg$currPos += 12; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e158); } + if (peg$silentFails === 0) { peg$fail(peg$e159); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11271,12 +11354,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 11).toLowerCase() === peg$c141) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c142) { s2 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e159); } + if (peg$silentFails === 0) { peg$fail(peg$e160); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11302,12 +11385,12 @@ function peg$parse(input, options) { } if (s1 === peg$FAILED) { s1 = peg$currPos; - if (input.substr(peg$currPos, 4).toLowerCase() === peg$c142) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c143) { s2 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e160); } + if (peg$silentFails === 0) { peg$fail(peg$e161); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -11341,7 +11424,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f188(s1); + s1 = peg$f189(s1); } s0 = s1; @@ -11393,7 +11476,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f189(s1, s2); + s0 = peg$f190(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11415,7 +11498,7 @@ function peg$parse(input, options) { s5 = peg$parseRBRAKE(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f190(s3); + s0 = peg$f191(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11453,7 +11536,7 @@ function peg$parse(input, options) { if (s2 !== peg$FAILED) { s3 = peg$parsemem_chain(); peg$savedPos = s0; - s0 = peg$f191(s2, s3); + s0 = peg$f192(s2, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11480,7 +11563,7 @@ function peg$parse(input, options) { s5 = peg$parseRBRACE(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f192(s3, s4); + s0 = peg$f193(s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11552,7 +11635,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s1 = peg$f193(s1); + s1 = peg$f194(s1); s0 = s1; return s0; @@ -11562,11 +11645,11 @@ function peg$parse(input, options) { var s0; if (input.charCodeAt(peg$currPos) === 36) { - s0 = peg$c143; + s0 = peg$c144; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e161); } + if (peg$silentFails === 0) { peg$fail(peg$e162); } } return s0; @@ -11575,12 +11658,12 @@ function peg$parse(input, options) { function peg$parseKW_RETURN() { var s0; - if (input.substr(peg$currPos, 6).toLowerCase() === peg$c144) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c145) { s0 = input.substr(peg$currPos, 6); peg$currPos += 6; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e162); } + if (peg$silentFails === 0) { peg$fail(peg$e163); } } return s0; @@ -11589,12 +11672,12 @@ function peg$parse(input, options) { function peg$parseKW_ASSIGN() { var s0; - if (input.substr(peg$currPos, 2) === peg$c145) { - s0 = peg$c145; + if (input.substr(peg$currPos, 2) === peg$c146) { + s0 = peg$c146; peg$currPos += 2; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e163); } + if (peg$silentFails === 0) { peg$fail(peg$e164); } } return s0; @@ -11623,7 +11706,7 @@ function peg$parse(input, options) { s9 = null; } peg$savedPos = s0; - s0 = peg$f194(s1, s3, s7, s9); + s0 = peg$f195(s1, s3, s7, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11653,7 +11736,7 @@ function peg$parse(input, options) { s5 = peg$parsetable_name(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f195(s1, s5); + s0 = peg$f196(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11671,7 +11754,7 @@ function peg$parse(input, options) { s1 = peg$parsetable_name(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f196(s1); + s1 = peg$f197(s1); } s0 = s1; } @@ -11693,7 +11776,7 @@ function peg$parse(input, options) { if (s5 !== peg$FAILED) { s6 = peg$parse__(); peg$savedPos = s0; - s0 = peg$f197(s1, s3, s5); + s0 = peg$f198(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11715,7 +11798,7 @@ function peg$parse(input, options) { if (s3 !== peg$FAILED) { s4 = peg$parse__(); peg$savedPos = s0; - s0 = peg$f198(s1, s3); + s0 = peg$f199(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11736,7 +11819,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_DROP_TABLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f199(s1); + s1 = peg$f200(s1); } s0 = s1; @@ -11759,7 +11842,7 @@ function peg$parse(input, options) { s7 = peg$parseselect_stmt(); if (s7 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f200(s1, s3, s5, s7); + s0 = peg$f201(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11796,7 +11879,7 @@ function peg$parse(input, options) { s11 = peg$parseRPAREN(); if (s11 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f201(s1, s3, s5, s9); + s0 = peg$f202(s1, s3, s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11838,7 +11921,7 @@ function peg$parse(input, options) { s9 = peg$parseRPAREN(); if (s9 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f202(s1, s3, s7); + s0 = peg$f203(s1, s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11872,7 +11955,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_CREATE_TABLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f203(s1); + s1 = peg$f204(s1); } s0 = s1; @@ -11886,7 +11969,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_IF_NOT_EXISTS(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f204(s1); + s1 = peg$f205(s1); } s0 = s1; @@ -11952,7 +12035,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f205(s1, s2); + s0 = peg$f206(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11974,7 +12057,7 @@ function peg$parse(input, options) { s5 = peg$parsefield_constraint_list(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f206(s1, s3, s5); + s0 = peg$f207(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -11995,7 +12078,7 @@ function peg$parse(input, options) { s3 = peg$parsefield_data_type(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f207(s1, s3); + s0 = peg$f208(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12121,7 +12204,7 @@ function peg$parse(input, options) { s21 = null; } peg$savedPos = s0; - s0 = peg$f208(s1, s5, s6, s10, s12, s16, s17, s21); + s0 = peg$f209(s1, s5, s6, s10, s12, s16, s17, s21); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12190,7 +12273,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f209(s1, s3, s5); + s0 = peg$f210(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12261,7 +12344,7 @@ function peg$parse(input, options) { s8 = peg$parseRPAREN(); if (s8 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f210(s1, s5, s6); + s0 = peg$f211(s1, s5, s6); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12336,7 +12419,7 @@ function peg$parse(input, options) { s8 = peg$parseRPAREN(); if (s8 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f211(s1, s5, s6); + s0 = peg$f212(s1, s5, s6); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12358,7 +12441,7 @@ function peg$parse(input, options) { s1 = peg$parseident(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f212(s1); + s1 = peg$f213(s1); } s0 = s1; } @@ -12397,7 +12480,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f213(s1, s2); + s0 = peg$f214(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12436,7 +12519,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_not_null(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f214(s1); + s1 = peg$f215(s1); } s0 = s1; @@ -12450,7 +12533,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NOT_NULL(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f215(s1); + s1 = peg$f216(s1); } s0 = s1; @@ -12464,7 +12547,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_primary_key(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f216(s1); + s1 = peg$f217(s1); } s0 = s1; @@ -12478,7 +12561,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_PRIMARY_KEY(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f217(s1); + s1 = peg$f218(s1); } s0 = s1; @@ -12492,7 +12575,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_unique(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f218(s1); + s1 = peg$f219(s1); } s0 = s1; @@ -12506,7 +12589,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_UNIQUE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f219(s1); + s1 = peg$f220(s1); } s0 = s1; @@ -12520,7 +12603,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_auto_increment(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f220(s1); + s1 = peg$f221(s1); } s0 = s1; @@ -12534,7 +12617,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_AUTO_INCREMENT(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f221(s1); + s1 = peg$f222(s1); } s0 = s1; @@ -12561,7 +12644,7 @@ function peg$parse(input, options) { s7 = null; } peg$savedPos = s0; - s0 = peg$f222(s1, s3, s5, s7); + s0 = peg$f223(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12581,7 +12664,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_always(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f223(s1); + s1 = peg$f224(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -12589,7 +12672,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_by_default(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f224(s1); + s1 = peg$f225(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -12597,7 +12680,7 @@ function peg$parse(input, options) { s1 = peg$parsekeyword_by_default_on_null(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f225(s1); + s1 = peg$f226(s1); } s0 = s1; } @@ -12622,7 +12705,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f226(s1, s3); + s0 = peg$f227(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12642,7 +12725,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_ALWAYS(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f227(s1); + s1 = peg$f228(s1); } s0 = s1; @@ -12656,7 +12739,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_BY_DEFAULT(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f228(s1); + s1 = peg$f229(s1); } s0 = s1; @@ -12670,7 +12753,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_BY_DEFAULT_ON_NULL(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f229(s1); + s1 = peg$f230(s1); } s0 = s1; @@ -12687,7 +12770,7 @@ function peg$parse(input, options) { s3 = peg$parseident(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f230(s3); + s0 = peg$f231(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12731,7 +12814,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f231(s1); + s1 = peg$f232(s1); } s0 = s1; } @@ -12770,7 +12853,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f232(s1, s2); + s0 = peg$f233(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12830,7 +12913,7 @@ function peg$parse(input, options) { s5 = peg$parseint(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f233(s5); + s0 = peg$f234(s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12860,7 +12943,7 @@ function peg$parse(input, options) { s5 = peg$parseint(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f234(s5); + s0 = peg$f235(s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12887,7 +12970,7 @@ function peg$parse(input, options) { s3 = peg$parseint(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f235(s3); + s0 = peg$f236(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12910,7 +12993,7 @@ function peg$parse(input, options) { s3 = peg$parseint(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f236(s3); + s0 = peg$f237(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12930,7 +13013,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NO_MAXVALUE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f237(); + s1 = peg$f238(); } s0 = s1; @@ -12944,7 +13027,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NO_MINVALUE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f238(); + s1 = peg$f239(); } s0 = s1; @@ -12961,7 +13044,7 @@ function peg$parse(input, options) { s3 = peg$parseint(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f239(s3); + s0 = peg$f240(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -12981,7 +13064,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_CYCLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f240(); + s1 = peg$f241(); } s0 = s1; @@ -12995,7 +13078,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_NO_CYCLE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f241(); + s1 = peg$f242(); } s0 = s1; @@ -13012,7 +13095,7 @@ function peg$parse(input, options) { s3 = peg$parsecolumn_ref(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f242(s3); + s0 = peg$f243(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13032,7 +13115,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_OWNED_BY_NONE(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f243(); + s1 = peg$f244(); } s0 = s1; @@ -13058,7 +13141,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f244(s1, s3, s5); + s0 = peg$f245(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13097,7 +13180,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f245(s1); + s1 = peg$f246(s1); } s0 = s1; @@ -13114,7 +13197,7 @@ function peg$parse(input, options) { s3 = peg$parsefield(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f246(s1, s3); + s0 = peg$f247(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13134,7 +13217,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_ADD(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f247(s1); + s1 = peg$f248(s1); } s0 = s1; @@ -13151,7 +13234,7 @@ function peg$parse(input, options) { s3 = peg$parsecolumn_node(); if (s3 === peg$FAILED) { peg$savedPos = peg$currPos; - s3 = peg$f248(s1); + s3 = peg$f249(s1); if (s3) { s3 = peg$FAILED; } else { @@ -13160,7 +13243,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f249(s1, s3); + s0 = peg$f250(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13180,7 +13263,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_DROP_COLUMN(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f250(s1); + s1 = peg$f251(s1); } s0 = s1; @@ -13197,7 +13280,7 @@ function peg$parse(input, options) { s3 = peg$parsefield(); if (s3 === peg$FAILED) { peg$savedPos = peg$currPos; - s3 = peg$f251(s1); + s3 = peg$f252(s1); if (s3) { s3 = peg$FAILED; } else { @@ -13206,7 +13289,7 @@ function peg$parse(input, options) { } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f252(s1, s3); + s0 = peg$f253(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13241,7 +13324,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f253(s1); + s1 = peg$f254(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -13249,7 +13332,7 @@ function peg$parse(input, options) { s1 = peg$parseKW_MODIFY(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f254(s1); + s1 = peg$f255(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -13272,7 +13355,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f255(s1); + s1 = peg$f256(s1); } s0 = s1; } @@ -13314,7 +13397,7 @@ function peg$parse(input, options) { s17 = peg$parseRPAREN(); if (s17 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f256(s1, s3, s5, s7, s9, s11, s15); + s0 = peg$f257(s1, s3, s5, s7, s9, s11, s15); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13393,7 +13476,7 @@ function peg$parse(input, options) { s13 = peg$parseRPAREN(); if (s13 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f257(s1, s3, s5, s7, s11); + s0 = peg$f258(s1, s3, s5, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13436,7 +13519,7 @@ function peg$parse(input, options) { s3 = peg$parsefield_data_type(); if (s3 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f258(s1, s3); + s0 = peg$f259(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13494,7 +13577,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f259(s1, s2); + s0 = peg$f260(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13531,7 +13614,7 @@ function peg$parse(input, options) { s15 = peg$parseRPAREN(); if (s15 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f260(s1, s3, s5, s7, s9, s13); + s0 = peg$f261(s1, s3, s5, s7, s9, s13); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13613,7 +13696,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f261(s1, s2); + s0 = peg$f262(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13650,7 +13733,7 @@ function peg$parse(input, options) { s15 = peg$parseRPAREN(); if (s15 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f262(s1, s3, s5, s7, s9, s13); + s0 = peg$f263(s1, s3, s5, s7, s9, s13); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13709,7 +13792,7 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f263(s1, s5); + s0 = peg$f264(s1, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13727,7 +13810,7 @@ function peg$parse(input, options) { s1 = peg$parseident(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f264(s1); + s1 = peg$f265(s1); } s0 = s1; } @@ -13780,7 +13863,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f265(s1, s2); + s0 = peg$f266(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13829,7 +13912,7 @@ function peg$parse(input, options) { s7 = null; } peg$savedPos = s0; - s0 = peg$f266(s1, s3, s5, s7); + s0 = peg$f267(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13872,7 +13955,7 @@ function peg$parse(input, options) { s9 = null; } peg$savedPos = s0; - s0 = peg$f267(s1, s3, s5, s7, s9); + s0 = peg$f268(s1, s3, s5, s7, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13912,7 +13995,7 @@ function peg$parse(input, options) { s7 = null; } peg$savedPos = s0; - s0 = peg$f268(s1, s3, s5, s7); + s0 = peg$f269(s1, s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13970,7 +14053,7 @@ function peg$parse(input, options) { } } peg$savedPos = s0; - s0 = peg$f269(s1, s2); + s0 = peg$f270(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -13986,7 +14069,7 @@ function peg$parse(input, options) { s1 = peg$parseident(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f270(s1); + s1 = peg$f271(s1); } s0 = s1; @@ -14000,13 +14083,296 @@ function peg$parse(input, options) { s1 = peg$parseKW_DROP_VIEW(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f271(s1); + s1 = peg$f272(s1); } s0 = s1; return s0; } + function peg$parseset_stmt() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseKW_SET(); + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parsesession_authorization_assignment(); + if (s3 === peg$FAILED) { + s3 = peg$parsesearch_path_assignment(); + if (s3 === peg$FAILED) { + s3 = peg$parsevariable_assignment_list(); + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f273(s3); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsesession_authorization_assignment() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c147) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e165); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.substr(peg$currPos, 13).toLowerCase() === peg$c148) { + s3 = input.substr(peg$currPos, 13); + peg$currPos += 13; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e166); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseKW_TO(); + if (s5 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s5 = peg$c4; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parseliteral_string(); + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f274(s7); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsesearch_path_assignment() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c149) { + s1 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e167); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + s3 = peg$parseKW_TO(); + if (s3 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c4; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseliteral_string(); + if (s5 !== peg$FAILED) { + s6 = []; + s7 = peg$currPos; + s8 = peg$parse__(); + s9 = peg$parseCOMMA(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseliteral_string(); + if (s11 !== peg$FAILED) { + s8 = [s8, s9, s10, s11]; + s7 = s8; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + while (s7 !== peg$FAILED) { + s6.push(s7); + s7 = peg$currPos; + s8 = peg$parse__(); + s9 = peg$parseCOMMA(); + if (s9 !== peg$FAILED) { + s10 = peg$parse__(); + s11 = peg$parseliteral_string(); + if (s11 !== peg$FAILED) { + s8 = [s8, s9, s10, s11]; + s7 = s8; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f275(s1, s5, s6); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsevariable_assignment_list() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + s1 = peg$parsevariable_assignment(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevariable_assignment(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse__(); + s5 = peg$parseCOMMA(); + if (s5 !== peg$FAILED) { + s6 = peg$parse__(); + s7 = peg$parsevariable_assignment(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + peg$savedPos = s0; + s0 = peg$f276(s1, s2); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsevariable_assignment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 64) { + s2 = peg$c150; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e168); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseident_name(); + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$parse__(); + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c4; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e6); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse__(); + s5 = peg$parseliteral(); + if (s5 === peg$FAILED) { + s5 = peg$parseor_expr(); + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f277(s1, s5); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + var reservedMap = module.exports.reservedMap || {}; diff --git a/packages/sql-parser/parser.pegjs b/packages/sql-parser/parser.pegjs index 10c940fe..4de5a854 100644 --- a/packages/sql-parser/parser.pegjs +++ b/packages/sql-parser/parser.pegjs @@ -88,7 +88,8 @@ ast = alter_table_stmt / create_index_stmt / create_type_stmt / - drop_type_stmt + drop_type_stmt / + set_stmt union_stmt = head:select_stmt tail:(__ KW_UNION __ KW_ALL? __ select_stmt)* { @@ -1127,6 +1128,7 @@ KW_KEY = "KEY"i !ident_start { return 'KEY'; } KW_NOT = "NOT"i !ident_start { return 'NOT'; } KW_AND = "AND"i !ident_start { return 'AND'; } KW_OR = "OR"i !ident_start { return 'OR'; } +KW_TO = "TO"i !ident_start { return 'TO'; } KW_COUNT = "COUNT"i !ident_start { return 'COUNT'; } KW_MAX = "MAX"i !ident_start { return 'MAX'; } @@ -1990,3 +1992,57 @@ drop_view_keyword } } +set_stmt + = KW_SET __ + assignments:( + session_authorization_assignment / + search_path_assignment / + variable_assignment_list + ) { + return { + type: 'set', + assignments: assignments, + location: location() + } + } +session_authorization_assignment + = "session"i __ "authorization"i __ + (KW_TO / "=") __ + value:literal_string { + return { + type: 'session_authorization', + value: value, + location: location() + } + } + +search_path_assignment + = name:"search_path"i __ + (KW_TO / "=") __ + head:literal_string + tail:(__ COMMA __ literal_string)* { + return { + type: 'search_path', + value: createList(head, tail), + location: location() + } + } + +variable_assignment_list + = head:variable_assignment + tail:(__ COMMA __ variable_assignment)* { + return createList(head, tail) + } + +variable_assignment + = name:("@" ident_name) __ + "=" __ + value:(literal / expr) { + return { + type: 'variable', + name: name[1], + value: value, + location: location() + } + } + diff --git a/packages/sql-parser/test/set.test.js b/packages/sql-parser/test/set.test.js new file mode 100644 index 00000000..7952d225 --- /dev/null +++ b/packages/sql-parser/test/set.test.js @@ -0,0 +1,32 @@ +const { parse } = require('../index'); + +describe('SET statement', () => { + describe('Basic statement', () => { + it('should success to parse', () => { + const sql = 'SET @var1 = 1, @var2 = 2;'; + const result = parse(sql); + expect(result).toBeDefined(); + expect(result).toMatchObject({ + type: 'set', + variables: [ + { + type: 'variable', + name: '@var1', + value: { + type: 'number', + value: '1', + }, + }, + { + type: 'variable', + name: '@var2', + value: { + type: 'number', + value: '2', + }, + }, + ], + }); + }); + }); +}); \ No newline at end of file