> Yes, this is correct, there is no functionality in postgres to get the
> generated keys.
That's sad.
> This is because the keys are generated using a sequence which can be any
> of the columns in the row, there is no apriori knowledge of the column
> that is being generated.
First, we have to define what a "generated key" is! If you define it as
a value generated by a sequence, than this is hard to find out.
Simply take the following definition:
A column in the primary key is a "generated key", iff a value for the
columns hasn't been given in the INSERT and if the column has a default
value.
With this definition, is should be easy for the server to find the
generated keys.
> 2) get the key after the insert leaving the key value out of the insert,
> or inserting a null there. select currval('sequence_name');
but you have to know the sequence name for that. That's really bad!