Skip to content

[Feature] Prostgres Procedural DO $$BEGIN ... END$$ #1946

Open
@zdhuangelephant

Description

@zdhuangelephant

Always check against the Latest SNAPSHOT of JSQLParser and the Syntax Diagram

Failing SQL Feature:

  • Brief description of the failing SQL feature
  • Example: Encountered unexpected token: "DO" "DO" can't be parsed

SQL Example:

  • Simplified Query Example, focusing on the failing feature

DO $$
BEGIN
IF NOT EXISTS( select 1 from comm.permission_operation where permission_operation_code = 'ecg_report_time_modify') and EXISTS( select 1 from comm.permission where permission_code = 'data_modify')
THEN
INSERT INTO comm.permission_operation
(permission_operation_id,
permission_id,
permission_operation_code,
permission_operation_name,
"type",
"version",
his_org_id,
his_creater_id,
his_creater_name,
his_create_time,
his_updater_id,
his_update_time)
VALUES
((select max(permission_operation_id) + 1 from comm.permission_operation),
(select permission_id from comm.permission where permission_code = 'data_modify' limit 1),
'ecg_report_time_modify',
'心电报告时间修改',
'1',
0,
(select his_org_id from comm.hospital limit 1),
1,
'系统管理员',
now(),
1,
now()) on conflict(permission_operation_id) do nothing;
END IF;
END $$;
```

Software Information:

  • JSqlParser 4.7
  • Database PostgreSQL

Exception in thread "main" net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "DO" "DO" at line 1, column 1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions