X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B96425294C for ; Wed, 8 Jun 2005 11:45:25 -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 45777-08 for ; Wed, 8 Jun 2005 14:45:16 +0000 (GMT) Received: from smtp1.fuse.net (mail-out1.fuse.net [216.68.8.174]) by svr1.postgresql.org (Postfix) with ESMTP id 0BA40529A6 for ; Wed, 8 Jun 2005 11:45:06 -0300 (ADT) Received: from gx4.fuse.net ([69.61.188.66]) by smtp1.fuse.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20050608144508.LOKY19855.smtp1.fuse.net@gx4.fuse.net> for ; Wed, 8 Jun 2005 10:45:08 -0400 Received: from [127.0.0.1] (really [69.61.188.66]) by gx4.fuse.net (InterMail vG.1.02.00.02 201-2136-104-102-20041210) with ESMTP id <20050608144508.HTPC10638.gx4.fuse.net@[127.0.0.1]> for ; Wed, 8 Jun 2005 10:45:08 -0400 Message-ID: <42A7044B.4080604@gmail.com> Date: Wed, 08 Jun 2005 10:44:27 -0400 From: Lucas Hernndez User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Cursor need it? Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 0523-4, 06/08/2005), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/110 X-Sequence-Number: 21711 I am a new postgres user I want to get a list of tables from pg_tables where tables are like ‘%wo%’ (for example).. and then query that list …. Select count(*) from tableVARIABLENAMEFROMFIRSTQUERY In SQL SERVER I can do that using cursor but in postgresql I don’t understand how to use cursors Here is what I am trying to do for each table on the list Select tablename, count(*) tables from ( list of tables) tablename tables table1 25 table2 35 Any Idea would be appreciated Thanks Lucas