How is auto-increment set manually, so that a column that increments automatically will be created in a PostgreSQL database?
RESOLUTION 1:
1. Select data type "Serial" or "BigSerial" for a particular attribute.
2. Generate the DDL script and use it in your database.
3. In the database, PostgreSQL will automatically create a sequence and will relate to the attribute by default.
RESOLUTION 2:
Set manually in Toad Data Modeler what PostgreSQL can do automatically (e.g. as described in previous option).
1. Create a sequence, e.g. Sequence1. - Model Explorer | right-click the Sequences | Add.
2. Edit the particular attribute and in the 'Default' field, write the following: nextval('Sequence1').
Please Note: If you wish to make the sequence dependent on entity/attribute (which means that if the entity/attribute is deleted, the sequence will be deleted too), edit the sequence and on the 'General' tab, fill out the "Owned By" box. However, for basic functionality of auto-increment, this is not necessary.
If you add a primary key to an attribute, there is no need to select the 'Unique' checkbox and set it to an alternate key. The Primary key is automatically unique.
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center