Q:

How to reset the id number of newly generated PostGIS topology?

I'm trying to create a clean, new topology for testing by discarding the old topology first, i.e.:
SELECT DropTopology('ch13_topology');

SELECT CreateTopology('ch13_topology', 32610, 0.05);

However, one issue I have is that topology.CreateTopology is giving a different (increasing) id number each time for the topology. The first time, it returns 1, the second time it returns 2, and so on, even though the old topology has been dropped.
I understand it's safe to always increase the id number. But,
Is there a way to make topology.CreateTopology return the smallest id number possible?
In the case shown above, this would be always 1, or whatever number it is at the first call of {drop,create}topology(). I need this so that I don't have to change the id numbers in subsequent SQL statements.

A:

The topology id is provided by PostgreSQL's sequence generator. You can modify this generator's next value with setval. For example, if you want the generator's next value to be 1, then:
SELECT setval('topology.topology_id_seq', 1, false);

