非常像主題說。Postgres截斷重啓身份不重啓身份
truncate table "Account" restart identity cascade;
insert into "Account" ("name", "enabled") values ("test", 1);
select * from "Account";
輸出:
accountId | name | enabled
-----------+------+---------
14 | test | 1
(1 row)
這是表的模式:
Table "public.Account"
Column | Type | Modifiers
-----------+------------------------+---------------------------------------------------------------
accountId | integer | not null default nextval('"Account_accountId_seq"'::regclass)
name | character varying(255) | not null
enabled | integer | not null
Indexes:
"Account_pkey" PRIMARY KEY, btree ("accountId")
Referenced by:
TABLE ""AccountPropertyAccess"" CONSTRAINT "AccountPropertyAccess_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account"("accountId")
TABLE ""User"" CONSTRAINT "User_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account"("accountId")
這裏有一些多餘的話,因爲堆疊交換認爲我沒有足夠的話,因爲我代碼太多了。
顯示錶模式'\ D 「帳戶」' –
新增表模式。 – bblack
您在第一個代碼塊中的插入語句無效。字符串文字必須使用單引號'「test」'表示列,而不是值。 –