Skip to content

[BUG] supporting PG syntax 'ALTER COLUMN ... SET DATA TYPE ...' #6467

@GAATTC0

Description

@GAATTC0

Database Type

PG

Database Version

pg15

Druid Version

1.2.23

JDK Version

OpenJDK 21

Error SQL

alter table if exists <TableName> alter column <ColumnName> set data type <Type>

Testcase Code

sql generated by spring data jpa via spring.jpa.properties.hibernate.hbm2ddl.auto=update

Stacktrace Info

com.alibaba.druid.sql.parser.ParserException: syntax error, error in :' set data type decimal(12,2)', expect DEFAULT, actual null, pos 70, line 1, column 67, token IDENTIFIER data
	at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:862)
	at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:870)
	at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseAlterColumn(PGSQLStatementParser.java:591)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseAlter(SQLStatementParser.java:2022)
	at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseAlter(PGSQLStatementParser.java:524)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:339)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:106)
	at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:164)
	at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:135)
	at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:158)

Error Info

No response

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