X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5C933D849F for ; Thu, 8 Sep 2005 09:42:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83019-04 for ; Thu, 8 Sep 2005 12:42:47 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 7848BD8430 for ; Thu, 8 Sep 2005 09:42:48 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j88Cgnjo037499 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Sep 2005 06:42:51 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j88CgmCq068739; Thu, 8 Sep 2005 06:42:48 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j88Cgm12068738; Thu, 8 Sep 2005 06:42:48 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 8 Sep 2005 06:42:48 -0600 From: Michael Fuhr To: Thusitha Kodikara Cc: pgsql-admin@postgresql.org Subject: Re: Relationship beween sequences (serial) and tables Message-ID: <20050908124248.GA68650@winnie.fuhr.org> References: <20050908080327.94284.qmail@web34405.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050908080327.94284.qmail@web34405.mail.mud.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200509/74 X-Sequence-Number: 18811 On Thu, Sep 08, 2005 at 01:03:26AM -0700, Thusitha Kodikara wrote: > In many of my tables the primary key is bigserial for which > sequences are automatcially generated. Through pg_catalog tables > how can I find the relationship petween each table and its corresponding > sequence ? Depending on what information you're looking for, you might need to query any of the following tables: pg_attrdef pg_attribute pg_class pg_constraint pg_depend pg_index See also "Miscellaneous Functions" ("System Information Functions" in 8.x) in the "Functions and Operators" chapter of the documentation. It can also be useful to run "psql -E" or use "\set ECHO_HIDDEN" in psql to show the SQL queries that psql makes for \d commands. -- Michael Fuhr