|
66 | 66 | 'RENAME': true, |
67 | 67 | // 'REPLACE': true, |
68 | 68 | 'RIGHT': true, |
| 69 | + 'ROW': true, |
69 | 70 | 'ROWS': true, |
70 | 71 |
|
71 | 72 | 'SELECT': true, |
@@ -2470,7 +2471,7 @@ table_base |
2470 | 2471 | // => table_name & { as?: alias_clause; } |
2471 | 2472 | if (t.type === 'var') { |
2472 | 2473 | t.as = alias; |
2473 | | - Object.assign(t, {...getLocationObject()}) |
| 2474 | + t = { ...t, ...getLocationObject() } |
2474 | 2475 | return t; |
2475 | 2476 | } else { |
2476 | 2477 | return { |
@@ -3073,6 +3074,21 @@ case_else = KW_ELSE __ result:expr { |
3073 | 3074 | return { type: 'else', result: result }; |
3074 | 3075 | } |
3075 | 3076 |
|
| 3077 | +row_value_list |
| 3078 | + = head:column_list_item tail:(__ COMMA __ column_list_item)* { |
| 3079 | + // => column_list_item[] |
| 3080 | + return createList(head, tail); |
| 3081 | + } |
| 3082 | + |
| 3083 | +row_expr |
| 3084 | + = KW_ROW __ LPAREN __ l:row_value_list __ RPAREN { |
| 3085 | + // => { type: 'row_constructor', value: row_value_list } |
| 3086 | + return { |
| 3087 | + type: 'struct', |
| 3088 | + keyword: 'row', |
| 3089 | + expr_list: l |
| 3090 | + }; |
| 3091 | + } |
3076 | 3092 | /** |
3077 | 3093 | * Borrowed from PL/SQL ,the priority of below list IS ORDER BY DESC |
3078 | 3094 | * --------------------------------------------------------------------------------------------------- |
@@ -3347,6 +3363,7 @@ column_ref_array_index |
3347 | 3363 | } |
3348 | 3364 | primary |
3349 | 3365 | = cast_expr |
| 3366 | + / row_expr |
3350 | 3367 | / LPAREN __ list:or_and_where_expr __ RPAREN { |
3351 | 3368 | // => or_and_where_expr |
3352 | 3369 | list.parentheses = true; |
@@ -4396,6 +4413,7 @@ KW_BIGSERIAL = "BIGSERIAL"i !ident_start { return 'BIGSERIAL'; } |
4396 | 4413 | KW_REAL = "REAL"i !ident_start { return 'REAL'; } |
4397 | 4414 | KW_DATE = "DATE"i !ident_start { return 'DATE'; } |
4398 | 4415 | KW_DATETIME = "DATETIME"i !ident_start { return 'DATETIME'; } |
| 4416 | +KW_ROW = "ROW"i !ident_start { return 'ROW'; } |
4399 | 4417 | KW_ROWS = "ROWS"i !ident_start { return 'ROWS'; } |
4400 | 4418 | KW_TIME = "TIME"i !ident_start { return 'TIME'; } |
4401 | 4419 | KW_TIMESTAMP= "TIMESTAMP"i!ident_start { return 'TIMESTAMP'; } |
|
0 commit comments