Thread: pg-dump -- primary Key
I was looking at the pg_dump and realized that it does not indicate the primary keys. Why is this? It does dump the primary keys with the indexed, however as far as I could tell, it did not indicate anything as the primary key. Yes, I am aware that the primary key does not really mean anything except implicitly making it a unique key, but it's supposed to be there for compatibility and it's not even in the dump. It's not a huge deal, but I was wondering if there was reasoning behind it of which I am unaware. -Dan
Dan Wilson wrote: > Yes, I am aware that the primary key does not really mean anything except > implicitly making it a unique key, but it's supposed to be there for > compatibility and it's not even in the dump. Someone mentioned recently that primary key enforces nulls as unique whereas unique index doesn't. > > It's not a huge deal, but I was wondering if there was reasoning behind it > of which I am unaware. > > -Dan -- Chris Bitmead mailto:chris@tech.com.au http://www.techphoto.org - Photography News, Stuff that Matters
On Sun, Jul 25, 1999 at 03:13:39PM +1000, Chris Bitmead wrote: > Dan Wilson wrote: > > > Yes, I am aware that the primary key does not really mean anything except > > implicitly making it a unique key, but it's supposed to be there for > > compatibility and it's not even in the dump. > > Someone mentioned recently that primary key enforces nulls as unique > whereas unique index doesn't. > Actually, I belive it enforces NOT NULL on primary keys, which it also dumps in the pg_dump output. Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
I understand this, but does it set the indisprimary flag in the pg_index table? The reason I ask is because I am writing a web based app to administer a pgsql database and am attempting to keep track of the indices/keys. This is the property I am looking at determine whether the index is a primary key. Is there a better property or flag to examine for this purpose? -Dan > On Sun, Jul 25, 1999 at 03:13:39PM +1000, Chris Bitmead wrote: > > Dan Wilson wrote: > > > > > Yes, I am aware that the primary key does not really mean anything except > > > implicitly making it a unique key, but it's supposed to be there for > > > compatibility and it's not even in the dump. > > > > Someone mentioned recently that primary key enforces nulls as unique > > whereas unique index doesn't. > > > > Actually, I belive it enforces NOT NULL on primary keys, which it also > dumps in the pg_dump output. > > Ross