From: | "Jim C(dot) Nasby" <decibel(at)decibel(dot)org> |
---|---|
To: | Alvaro Herrera <alvherre(at)surnet(dot)cl> |
Cc: | Juan Pablo Espino <jp(dot)espino(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Returning the name of a primary key |
Date: | 2005-05-17 05:24:25 |
Message-ID: | 20050517052425.GK30902@decibel.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, May 16, 2005 at 02:35:03PM -0400, Alvaro Herrera wrote:
> 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.
http://lnk.nu/cvs.pgfoundry.org/2op.sql is an example of how to get the
info in pure SQL.
--
Jim C. Nasby, Database Consultant decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-05-17 05:32:03 | Learning curves and such (was Re: pgFoundry) |
Previous Message | Tom Lane | 2005-05-17 04:42:39 | Re: SQL99 hierarchical queries stalled |