From: | darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain) |
---|---|
To: | pgsql-hackers(at)PostgreSQL(dot)org |
Subject: | Finding primary keys in a table |
Date: | 1998-07-20 13:22:14 |
Message-ID: | m0yyFtO-00006BC@druid.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I am trying to finish off my Python interface with some extra helper
functions and I need to find the primary key in a table if it exists.
I have two questions.
Although I can't imagine doing so, will the system allow you to create
more than one primary key on a table? I just need to know whether I
ned to test for multiple keys.
Can someone suggest a SQL statement to pull out the primary key(s) from
a table?
Also, if multiple keys are allowed, what are people's opinions about
using them? Basically I am creating a get function that is defined as:
def db_get(db, cl, arg, keyname = None):
where db is the database handle, cl is the class, arg is either a value
to lookup or a dictionary containing the value and keyname is the
field to lookup which defaults to the primary key. The question is,
what do I do if keyname is omitted (defaults to primary) and there
are two primary keys. Should I just use the first one or should I
raise an exception. I favour the latter.
--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1998-07-20 14:48:11 | Re: [HACKERS] using C++ to define new functions |
Previous Message | Bruce Momjian | 1998-07-20 09:37:14 | Re: [HACKERS] Name type vs. char * |