Postgres table contains 1 column, and that column is PK. How to insert new record? In my application, I have an abstract base class, and 2 derived classes.  The number of derived classed will probably not increase.  If it does, it won't be more than a few.

The class structure looks like this:

abstract class Base
{
    int FirstParameter
    int SecondParameter
    abstract void DoSomeWork();
}

class Foo : Base
{
    int FoosParameter
    override void DoSomeWork(){...}
}

class Bar : Base
{
    override void DomeWork(){...}
}


Essentially, Bar only needs the data provided by Base, but does its own work on the data.  From a data standpoint, Bar and Base are the same.  Foo, on the other hand, has some extra data tacked on to it.  

The database has 3 tables, one for Base, one for Foo, and for Bar.  Since the number of subclasses is not going to grow significantly, it makes more sense to give each class its own table.

tblBase:

base_id PK,
first_parameter int not null,
second_parameter int not null,
foo_id int,
bar_id int


tblFoo:

foo_id PK,
foos_parameter int not null,


tblBar:

bar_id PK


tblBar consists of 1 column, which is the auto incrementing primary key.  The primary key is stored in tblBase in column bar_id, which will identify any Base as being a Bar.  

Now, for the real kicker:  How does one insert a new record into tblBar, when the only column is the auto incrementing primary key?  I suppose I could do 

insert into tblBar(bar_id) 
select max(bar_id) + 1 
from tblBar


but that seems a bit....clunky.
Doing a insert .. select max() ... is a bad idea to begin with as it doesn't work correctly in a multi user environment. Plus it would get the sequence behind the serial column out of sync with the already generated values.

What you are looking for is: 

insert into bar (bar_id) values (default);


Another option would be explicitly call nextval() when inserting.

insert into bar (bar_id) values (nextval('bar_bar_id_seq'));