Re: Returning the name of a primary key

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: Juan Pablo Espino <jp(dot)espino(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Returning the name of a primary key
Date: 2005-05-16 18:35:03
Message-ID: 20050516183503.GA7400@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 16, 2005 at 01:25:46PM -0500, Juan Pablo Espino wrote:

> 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:

Why mess around with a C function, if you can do it in straight SQL?
You can write a SQL function if need be.

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
Voy a acabar con todos los humanos / con los humanos yo acabaré
voy a acabar con todos / con todos los humanos acabaré (Bender)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-05-16 18:35:19 Re: bitmap scans, btree scans, and tid order
Previous Message Juan Pablo Espino 2005-05-16 18:25:46 Returning the name of a primary key