1. django + postgresql: how to reset primary key?
http://stackoverflow.com/questions/544791/django-postgresql-how-to-reset-primary-key
這個是用于在清除表中數(shù)據(jù)后,數(shù)據(jù)的 pk 不從1開始增長,將序列重新設(shè)置為1的方法。
In your app directory try this:
python?manage.py?help?sqlsequencereset
? ?
Pipe it into psql like this to actually run the reset:
python?manage.py?sqlsequencereset?myapp1?myapp2?|?psql
? ?
Edit: here's an example of the output from this command on one of my tables:
BEGIN;
SELECT?setval('"project_row_id_seq"',?coalesce(max("id"),?1),?max("id")?IS?NOT?null)?FROM?"project_row";
COMMIT;
每個人都需要一臺速度更快、更穩(wěn)定的 PC。隨著時間的推移,垃圾文件、舊注冊表數(shù)據(jù)和不必要的后臺進(jìn)程會占用資源并降低性能。幸運(yùn)的是,許多工具可以讓 Windows 保持平穩(wěn)運(yùn)行。
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://www.miracleart.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號