Search Postgresql Archives

Re: OID Usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 14, 2005 at 12:20:50PM -0700, Michael Fuhr wrote:
> On Fri, Jan 14, 2005 at 07:44:18PM +0100, Bo Lorentsen wrote:
> > Alvaro Herrera wrote:
> > 
> > >You can create a function to get the sequence name attached to a table.
> > >Of course, you should take into account the fact that there could be
> > >more than one (two serial fields in a table are rare but not
> > >impossible), but if your tables have only one sequence you should be OK.
> > >
> > Are there a way to find and test if it is a primary key ?
> 
> pg_index has an indisprimary column.

Yeah, though things get hairy that way because you have to peek at
pg_attribute to match the objsubid in pg_depend; and self-join pg_class
to get to the index itself.  Not sure if it all can be done in a single
query.

> If you run "psql -E" you'll see the queries that psql executes for
> commands like "\d foo".  Those commands query the system catalogs.

Sadly, there's hardly anything there that uses pg_depend.

-- 
"I dream about dreams about dreams", sang the nightingale
under the pale moon (Sandman)

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux