Closed wushuwu closed 4 months ago
An error also occurred while parsing 'map[]' and 'json_object'.
import { Parser } from 'node-sql-parser';
const parser = new Parser();
const sql = `
insert into sink_soc_10086_node_11(
pk
, f1
)
select
CAST(map[uri,uri] as VARCHAR)
, uri
from view_soc_10086_node_8
;
`
const ast = parser.astify(sql, {
database: 'flinksql'
});
import { Parser } from 'node-sql-parser';
const parser = new Parser();
const sql = `
select name, eventTime, eventDetail
from (
select
concat('AK泄露告警') as name,
cast(event_time as varchar) as eventTime,
json_object(
'risk-tag' value risk_tag,
'user-agent' value user_agent,
) as eventDetail
from check_risk
)
;
`
const ast = parser.astify(sql, {
database: 'flinksql'
});
@wushuwu Please open a new issue, and follow the issue template.
Describe the bug
{"message":"Expected \"#\", \"--\", \"/*\", \"UPDATE\", or [ \\t\\n\\r] but \"S\" found.","expected":[{"type":"class","parts":[" ","\t","\n","\r"],"inverted":false,"ignoreCase":false},{"type":"literal","text":"/*","ignoreCase":false},{"type":"literal","text":"--","ignoreCase":false},{"type":"literal","text":"#","ignoreCase":false},{"type":"literal","text":"UPDATE","ignoreCase":true},{"type":"class","parts":[" ","\t","\n","\r"],"inverted":false,"ignoreCase":false},{"type":"literal","text":"/*","ignoreCase":false},{"type":"literal","text":"--","ignoreCase":false},{"type":"literal","text":"#","ignoreCase":false},{"type":"literal","text":"UPDATE","ignoreCase":true}],"found":"S","location":{"start":{"offset":526,"line":16,"column":40},"end":{"offset":527,"line":16,"column":41}},"name":"SyntaxError"}
Database Engine SQL Server.Using code