Juan Pablo Espino <jp(dot)espino(at)gmail(dot)com> writes:
> I need to write a function that retrieve the name of at least one
> table primary key, if it exists. The only argument passed to the
> function is the table name. I have thought something like this:
You need to be searching the list of indexes, not the attributes per se.
ATExecDropNotNull() might be a useful example.
regards, tom lane