What is the correct syntax to create an integer primary key auto incremental field in PostgreSQL using C++?
I started with
db->ExecuteSQL("CREATE TABLE mytable (\"mytableid\" INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
This compiles but the process crashes and no field is created.
db->ExecuteSQL("CREATE TABLE mytable (\"mytableid\" serial PRIMARY KEY NOT NULL,
This works and does create the field correctly.
Do I need the NOT NULL
or is this not necessary with serial
?
Is this the best syntax and method in Postgres for primary key field creation?