在SQLite3场景下,Sync不支持Modify Column:Error: near MODIFY: syntax error #2267
No reviewers
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#2267
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "brookechen/xorm:master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
rebase
masterto 在SQLite3场景下,Sync不支持Modify Column:Error: near MODIFY: syntax errorCould you give some tests?
实际这是一个功能缺失导致的bug。
目前xorm的
Dialect
实现中,只有postgres.ModifyColumnSQL
实现了修改comment能力。这个用例在非 postgres上执行时,只能验证多次Sync时,不出错误。而在sqlite3上,原有版本会出现如下错误:
在SQLite3场景下,Sync不支持Modify Column:Error: near MODIFY: syntax errorto WIP: 在SQLite3场景下,Sync不支持Modify Column:Error: near MODIFY: syntax errorWIP: 在SQLite3场景下,Sync不支持Modify Column:Error: near MODIFY: syntax errorto 在SQLite3场景下,Sync不支持Modify Column:Error: near MODIFY: syntax errorI think both MySQL and postgres supports change the comment? Maybe you need to add MySQL too.
原来的mysql dialect 逻辑不支持 alter column comment 的,现在我加上了,请 CR
另外,发现个问题:数据库为cockroach时, 当 struct column 类型为 int 时,create 语句时是设置的 has_comment 列为 INTEGER 类型,但是再查询时,列类型为 BIGINT,导致用例失败,因此先将用例中 has_comment 列设置为 bigint。cockroach 的数据类型问题另外跟进。
相关 sql 如下:
CREATE TABLE IF NOT EXISTS "public"."test_comment_struct" ("has_comment" INTEGER NULL); COMMENT ON COLUMN "public"."test_comment_struct"."has_comment" IS 'this is a comment before update'; [] - 23.943542ms
SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, description,
CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey,
CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey
FROM pg_attribute f
JOIN pg_class c ON c.oid = f.attrelid JOIN pg_type t ON t.oid = f.atttypid
LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum
LEFT JOIN pg_description de ON f.attrelid=de.objoid AND f.attnum=de.objsubid
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_constraint p ON p.conrelid = c.oid AND f.attnum = ANY (p.conkey)
LEFT JOIN pg_class AS g ON p.confrelid = g.oid
LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name
WHERE n.nspname= s.table_schema AND c.relkind = 'r' AND c.relname = $1 AND s.table_schema = $2 AND f.attnum > 0 ORDER BY f.attnum; [test_comment_struct public]