如何截断表并将 id 设置为默认值 1?

Rah*_*oni 0 postgresql

截断表并插入任何数据后,但在表中,表 id 不以 1 开头

截断表源;

小智 5

假设您的id列定义为identityserial使用以下restart identity选项:

truncate table source restart identity;
Run Code Online (Sandbox Code Playgroud)