{"id":80423,"date":"2017-04-15T16:40:49","date_gmt":"2017-04-15T16:40:49","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=80423"},"modified":"2017-04-15T16:41:44","modified_gmt":"2017-04-15T16:41:44","slug":"fix-missing-sequence-table-postgresql","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/","title":{"rendered":"How to fix missing sequence in PostgreSQL"},"content":{"rendered":"<p>Sequences objects are\u00a0commonly used to generate unique numbers for tables.<\/p>\n<p>In this blog i will demonstrate how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue. Below steps will help you to fix sequence missing issue.<\/p>\n<p>For example\u00a0<strong>test_webkul_id_seq <\/strong>sequence table is missing from your table(&#8220;<strong>test_webkul<\/strong>&#8220;). You can also check your sequence table from your table,<\/p>\n<pre class=\"brush:sql\">\\d+ test_webkul;<\/pre>\n<p><span style=\"color: #008000\">id \u00a0| integer \u00a0 | not null default nextval(&#8216;test_webkul_id_seq&#8217;::regclass) | plain \u00a0 \u00a0| \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|<\/span><\/p>\n<p>In order to fix missing sequence issue create sequence table by running in below command in your postgres terminal,<\/p>\n<pre class=\"brush:sql\">CREATE SEQUENCE test_webkul_id_seq;<\/pre>\n<p>Then set your table&#8217;s next sequence by running below command. This step is necessary only if some data is already present in your table. In case you forgot to run below command then sequence of table will start from 1.<\/p>\n<pre class=\"brush:sql\">SELECT setval('test_webkul_id_seq', 2500, true);<\/pre>\n<p>In above command,<\/p>\n<ul>\n<li>&#8220;test_webkul_id_seq&#8221; is\u00a0regclass.<\/li>\n<li>&#8220;2500&#8221; is next sequence of table.<\/li>\n<li>true\u00a0is_called flag.<\/li>\n<\/ul>\n<p><strong><span style=\"color: #3366ff\">Hopefully that blog will be helpful for you to fix issue!!<\/span><\/strong><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sequences objects are\u00a0commonly used to generate unique numbers for tables. In this blog i will demonstrate how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue. Below steps will help you to fix sequence missing issue. For example\u00a0test_webkul_id_seq sequence table <a href=\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":90,"featured_media":45511,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2007],"tags":[4387,4386,1267,4726,590],"class_list":["post-80423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-odoo","tag-fix","tag-issue","tag-odoo","tag-postgresql","tag-webkul"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to fix missing sequence in PostgreSQL<\/title>\n<meta name=\"description\" content=\"how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to fix missing sequence in PostgreSQL\" \/>\n<meta property=\"og:description\" content=\"how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-15T16:40:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-15T16:41:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ashish Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ashish Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\"},\"author\":{\"name\":\"Ashish Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/3b92c698256ce0bcb9613acf8bbf5b2d\"},\"headline\":\"How to fix missing sequence in PostgreSQL\",\"datePublished\":\"2017-04-15T16:40:49+00:00\",\"dateModified\":\"2017-04-15T16:41:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\"},\"wordCount\":184,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png\",\"keywords\":[\"fix\",\"issue\",\"odoo\",\"PostgreSQL\",\"webkul\"],\"articleSection\":[\"Odoo\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\",\"url\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\",\"name\":\"How to fix missing sequence in PostgreSQL\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png\",\"datePublished\":\"2017-04-15T16:40:49+00:00\",\"dateModified\":\"2017-04-15T16:41:44+00:00\",\"description\":\"how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to fix missing sequence in PostgreSQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/3b92c698256ce0bcb9613acf8bbf5b2d\",\"name\":\"Ashish Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ef2c82640f6054d8a8cfca9e3edd7edaf800ff1873b6d103c7bbf0b47dfefc1e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ef2c82640f6054d8a8cfca9e3edd7edaf800ff1873b6d103c7bbf0b47dfefc1e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ashish Singh\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/ashish067\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to fix missing sequence in PostgreSQL","description":"how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/","og_locale":"en_US","og_type":"article","og_title":"How to fix missing sequence in PostgreSQL","og_description":"how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue.","og_url":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-04-15T16:40:49+00:00","article_modified_time":"2017-04-15T16:41:44+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png","type":"image\/png"}],"author":"Ashish Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ashish Singh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/"},"author":{"name":"Ashish Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/3b92c698256ce0bcb9613acf8bbf5b2d"},"headline":"How to fix missing sequence in PostgreSQL","datePublished":"2017-04-15T16:40:49+00:00","dateModified":"2017-04-15T16:41:44+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/"},"wordCount":184,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png","keywords":["fix","issue","odoo","PostgreSQL","webkul"],"articleSection":["Odoo"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/","url":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/","name":"How to fix missing sequence in PostgreSQL","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png","datePublished":"2017-04-15T16:40:49+00:00","dateModified":"2017-04-15T16:41:44+00:00","description":"how to fix missing sequence in PostgreSQL. Actually when we upgrade our table from older to new version then sometimes we face missing sequence issue.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/04\/Odoo-Code-Snippet-banner.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/fix-missing-sequence-table-postgresql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to fix missing sequence in PostgreSQL"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/3b92c698256ce0bcb9613acf8bbf5b2d","name":"Ashish Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ef2c82640f6054d8a8cfca9e3edd7edaf800ff1873b6d103c7bbf0b47dfefc1e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef2c82640f6054d8a8cfca9e3edd7edaf800ff1873b6d103c7bbf0b47dfefc1e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ashish Singh"},"url":"https:\/\/webkul.com\/blog\/author\/ashish067\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/80423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/90"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=80423"}],"version-history":[{"count":5,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/80423\/revisions"}],"predecessor-version":[{"id":80429,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/80423\/revisions\/80429"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/45511"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=80423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=80423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=80423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}