Postgres dump: pg_catalog.setval

postgresql

Solution

You might want to check the fine manual:

setval(regclass, bigint) bigint Set sequence's current value

Example usage:;

# create sequence x;
CREATE SEQUENCE

# select nextval('x');
 nextval
---------
       1
(1 row)

# select nextval('x');
 nextval
---------
       2
(1 row)

# select nextval('x');
 nextval
---------
       3
(1 row)

# select setval('x', 10000);
 setval
--------
  10000
(1 row)

# select nextval('x');
 nextval
---------
   10001
(1 row)

# select nextval('x');
 nextval
---------
   10002
(1 row)

Problem

Does anyone know what pg_catalog.setval does? I just did a dump off a PostgreSQL database and got lots of lines with that in it. Not sure what it's for.

Original source