Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 024099FB883; Wed, 28 Feb 2007 14:35:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 54841-06; Wed, 28 Feb 2007 14:35:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id B23A29FA45F; Wed, 28 Feb 2007 14:35:19 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Wed, 28 Feb 2007 18:35:17 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 28 Feb 2007 12:35:17 -0600 Subject: Re: [SQL] system tables inquiry & db Link inquiry From: Scott Marlowe To: Karthikeyan Sundaram Cc: pgsql-admin@postgresql.org, pgsql-sql@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1172687717.20651.156.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 28 Feb 2007 12:35:17 -0600 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, BAYES_50, SPF_PASS, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200702/350 X-Sequence-Number: 24815 On Wed, 2007-02-28 at 12:19, Karthikeyan Sundaram wrote: > Hi, > > We are using Postgres 8.1.0 Stop. Do not pass go, do not collect $200. Update your postgresql installation now to 8.1.8. There were a lot of bugs fixed between 8.1.0 and 8.1.8. After that... > Question No 1: > ========= > There are lots of system tables that are available in postgres. For > example pg_tables will have all the information about the tables that are > present in a given schema. pg_views will have all the information about the > views for the given schema. > > I want to find all the sequences. What is the system tables that have > the information about all the sequences? In the future, you can use this trick to find those things out: psql -E template1 \? (command to list all the backslash commands from psql) \ds (<- command for listing sequences from psql) Tada, you now get the sql that psql used to make that display. For 8.2.3 that's: SELECT n.nspname as "Schema", c.relname as "Name", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END as "Type", r.rolname as "Owner" FROM pg_catalog.pg_class c JOIN pg_catalog.pg_roles r ON r.oid = c.relowner LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('S','') AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 1,2; > Question No 2: > ========= > > I have 2 postgres instance located in two different servers. I want > to create a DBlink (like in Oracle) between these 2. What are the steps > involved to create this. > > Any examples? Please advise. I'm pretty sure there's some examples in the contrib/dblink/doc directory in the source file to do that. It's pretty simple, I had it working about 5 minutes after installing dblink.