Auto Increment (Postgresql) Vs. AutoNumber (MS Access)

In Postgresql, prefer making Auto Increment for the table right from start. Following is code for a test table:

CREATE TABLE test_table(

    test_id SERIAL PRIMARY KEY

);

I wrote above code in pgAdmin 4 >> Tools >> Query Tool

Executing this query straight made the table under Public Schema. Then I altered the table (using graphic interface) and added another text column.

MS Access Autonumber vs. Postgresql Auto Increment

Difference with MS Access is that MS Access assigns autonumber according to sequence by just entering the data into another column. But Postgresql assigns Auto Increment when data of complete row is entered and cursor moves to next row. Since Auto Increment column cannot be null (and is also PRIMARY KEY), so it cannot be blank. Postgresql fills this column when cursor moves to next row (In MS Access linked table). Secondly, in Postgresql, it is possible to explicitly enter any value other than sequence. The same is not the behavior of MS Access. However, explicit entry in this column is to be avoided as it will create problems. For example in fourth row, I explicitly entered number 25. Then next row automatically took the number 4 and it worked up to number 24. Afterwards, auto increment failed for one time and number 26 was entered manually. Then auto increment kept going correctly.

Author: Magellanic Cloud

Author: A Philosophical Rejection of The Big Bang Theory Now writing: (i) "Philosophy Unscrambles Dark Matter" and; (ii) Descriptive Knowledge, Mind and Reality; a case of Epistemological Realism

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s