In one of the my PostgreSQL tables, I used a very handy builtin Sequence Manipulation function setval() of PostgreSQL to generate Primary Keys in a sequential and controlled manner. But during a migration, I wanted to identify new records by Primary Key sequence greater than thousand. A very handy and tested recipe to restart the setval() function sequence for such cases is by using RESTART WITH in the following way:
ALTER SEQUENCE seq RESTART WITH 1000;
is equivalent to:
SELECT setval('sequence_name', 1, FALSE);
Either of the above statements may be used to restart the sequence and for getting the next value following statement can be used:
nextval('sequence_name')
The above recipe can also be used to reset PostgreSQL primary key sequence when it falls out of sync.
Well Said, you have furnished the right information that will be useful to anyone at all time.
ReplyDeleteJAVA Training in Chennai
Selenium Training in Chennai
Advanced java training in chennai
JAVA Course in Chennai
Selenium Training
Selenium Course in Chennai
Java Training in Anna Nagar
selenium training in adyar
That’s a very useful information indeed. Kindly do share more post in detail.
ReplyDeleteSpoken English Classes in Chennai
Best Spoken English Classes in Chennai
Spoken English Class in Chennai
Spoken English in Chennai
English Speaking Classes in Mumbai
English Speaking Course in Mumbai
IELTS Coaching in Chennai
IELTS Coaching Centre in Chennai
IELTS Classes in Mumbai
IELTS Coaching in Mumbai
ReplyDeleteThanks for sharing this valuable information to our vision. You have posted a worthy blog keep sharing.
Salesforce Training in Chennai
Salesforce Training
Web Development courses in Chennai
ccna course in Chennai
PHP Training in Chennai
gst classes in chennai
Tally Course in Chennai
ux design course in chennai
web designing training in chennai
This comment has been removed by the author.
ReplyDeleteI was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. PostgreSQL NULL value
ReplyDeleteThanks for sharing this blog.Its seems to be having all adequate information.
ReplyDeleteIELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
spoken english classes in chennai | Communication training
thanks for giving amazing article...
ReplyDeleteDeep learning Training in coimbatore
Google cloud training in coimbatore
Mern Stack training in coimbatore
flutter Training in coimbatore
kotlin training in coimbatore
python fullstack training in coimbatore
Az-104 Training in coimbatore
Aws Certification Center in coimbatore
Azure Certification Center in coimbatore
ZModeler Crack is an ideal included 3D demonstrating an interest which intends to benefit visual specialists joined by making the low. Zmodeler 3 Crack
ReplyDeleteVery interesting and useful blog.
ReplyDeleteSQL Classes in Pune