Brian McCane <bmccane@mccons.net> writes:
> Okay, thanks for that information. I will have to dig through my
> pgsql-admin archive here and find the code for setting the primary key
> flag. Unless of course someone would like to offer me the information
> *HINT* :).
If you'd like to be backwards-compatible with older backends, I think
you need to reach in and set the indisprimary field of the pg_index
row for the index.
As of 7.2 or so there is an ALTER TABLE ADD PRIMARY KEY syntax that you
could use instead of creating the index directly. This would be better
since it doesn't require superuser privileges...
regards, tom lane