本文介绍了更改 postgreSQL 序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对 postgreSQL 非常陌生.我有一个默认从 1 开始的序列.我正在寻找的是,如果我想将我的下一个值(现在是 87)移动到 2000.我无法做到这一点.有人可以建议我如何进行更改吗?
I am quite very new to postgreSQL. I am have a sequence which starts from 1 by default. What I am looking for is that if I want to move my next value, which is now 87, to 2000. I am unable to do that. Can any one suggest me how to go about doing the change?
推荐答案
您可以使用以下代码更改顺序:
You can ALTER the sequence using the following code:
ALTER SEQUENCE seq_name RESTART 2000.
我请求您阅读 postgres SQL 手册.
I request you to please go through the postgres SQL manuals.
http://www.postgresql.org/docs/current/static/sql-altersequence.html
这篇关于更改 postgreSQL 序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!