DBeaver将主键设为自增 创建表并设置id自增
DBeaver-很多版本自增加不了ID,报错“[SQLITE_ERROR] SQL error or missing database (AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY)”
Error creating new object
原因:
Cannot invoke "org.jkiss.dbeaver.model.struct.DBSObject.getDataSource()" because "container" is null
CREATE TABLE [Invoice2]
(
[InvoiceId] INTEGER NOT NULL,
[CustomerId] INTEGER NOT NULL,
[InvoiceDate] DATETIME NOT NULL,
[BillingAddress] NVARCHAR(70),
[BillingCity] NVARCHAR(40),
[BillingState] NVARCHAR(40),
[BillingCountry] NVARCHAR(40),
[BillingPostalCode] NVARCHAR(10),
[Total] NUMERIC(10,2) NOT NULL,
CONSTRAINT [PK_Invoice2] PRIMARY KEY ([InvoiceId]),
FOREIGN KEY ([CustomerId]) REFERENCES [Customer] ([CustomerId])
ON DELETE NO ACTION ON UPDATE NO ACTION





4、新建序列
5、回到创建的表,在id默认值里面输入下面代码'里面是你新建的序列'最后保存执行
nextval('tooksto'::regclass)
这样表就中id就能自增啦

blog.csdn.net/weixin_53053828/article/details/129838160
blog.csdn.net/csdnjyc/article/details/132418239

浙公网安备 33010602011771号