RSS Amplifier

Brian Wigginton · Jun 3, 2015

Postgres Insert row with only an auto increment column

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

How do you insert a record into a postgres table that has a single auto incrementing primary key field? There weren’t many hits on google with the solution, so hopefully this helps someone else: INSERT INTO [table] (id) values (default); I originally tried using null and 0 as the values, but null throws a primary key constraint error and 0 actually gets inserted as 0.

Read on /2015/06/postgres-insert-row-with-only-an-auto-increment-column/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.