Skip to content

cannot parse mysql column in JSON_OBJECT function #1504

Closed
@532780857

Description

@532780857

Mysql version: 8.0

JSQLParser verison: 4.3

sql example:

// this is bad sql
SELECT JSON_OBJECT('account',account) as obj FROM tb_team;

// this is success sql
SELECT JSON_OBJECT('account','some string') as obj FROM tb_team;

bad sql exception:

image

DDL

CREATE TABLE `tb_team` (
  `id` bigint(20) NOT NULL COMMENT '雪花id',
  `process_instance_id` varchar(64) DEFAULT NULL COMMENT '流程id',
  `relevance_id` bigint(20) DEFAULT NULL COMMENT '发布id',
  `apply_id` bigint(20) DEFAULT NULL COMMENT '报名id',
  `account` varchar(32) DEFAULT NULL COMMENT '学工号',
  `originator` varchar(32) DEFAULT NULL COMMENT '发起人',
  `team_type` tinyint(4) DEFAULT NULL COMMENT '类型',
  `member_type` tinyint(4) DEFAULT NULL COMMENT '成员类型',
  `join_type` tinyint(4) DEFAULT NULL COMMENT '加入类型',
  `open_status` tinyint(4) DEFAULT NULL COMMENT '成员状态',
  `creator` varchar(64) DEFAULT NULL COMMENT '创建者',
  `updater` varchar(64) DEFAULT NULL COMMENT '修改者',
  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  `deleted` bit(1) DEFAULT b'0' COMMENT '删除标志',
  `tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='队伍成员表';

image

An exception will occur if the 'account' column comes from the tb_team table

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions