3

我有下postgresqlmyapp_mymodel_id_seq

    Column     |  Type   |           Value            
---------------+---------+----------------------------
 sequence_name | name    | myapp_mymodel_id_seq
 last_value    | bigint  | 3
 start_value   | bigint  | 1
 increment_by  | bigint  | 1
 max_value     | bigint  | 9223372036854775807
 min_value     | bigint  | 1
 cache_value   | bigint  | 1
 log_cnt       | bigint  | 32
 is_cycled     | boolean | f
 is_called     | boolean | t

如何3Valuelast_valueto下更改40

我尝试更新last_value,但它无法识别该列。

UPDATE myapp_mymodel_id_seq SET Value=40 WHERE Value=3;

ERROR:  column "value" does not exist
4

2 回答 2

5
select setval('myapp_mymodel_id_seq', 40);

有关详细信息,请参阅手册:http ://www.postgresql.org/docs/current/static/functions-sequence.html

于 2013-02-01T12:16:37.210 回答
-2

更新 myapp_mymodel_id_seq SET last_value = 40 WHERE last_value = 3;

于 2013-02-01T12:18:37.243 回答