我在postgresql
中有以下表格:myapp_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
如何将3
和Value
下的last_value
更改为40
?
我尝试更新last_value
,但无法识别该列。
UPDATE myapp_mymodel_id_seq SET Value=40 WHERE Value=3;
ERROR: column "value" does not exist
答案 0 :(得分:3)
select setval('myapp_mymodel_id_seq', 40);
有关详细信息,请参阅手册:http://www.postgresql.org/docs/current/static/functions-sequence.html
答案 1 :(得分:-2)
更新myapp_mymodel_id_seq SET last_value = 40 WHERE last_value = 3;