X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C6081D9CAD for ; Fri, 30 Sep 2005 19:47:47 -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 16843-09 for ; Fri, 30 Sep 2005 22:47:44 +0000 (GMT) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.194]) by svr1.postgresql.org (Postfix) with ESMTP id E45DED9CA2 for ; Fri, 30 Sep 2005 19:47:44 -0300 (ADT) Received: by qproxy.gmail.com with SMTP id p36so26233qba for ; Fri, 30 Sep 2005 15:47:48 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=LDiGrhjADS4I8Zcgce7HJVSpK+i2KMMJq+Y5ljRrwTQCCVwnXtQkGpTft8lellEgPpeipbqpc2LuS32sGf6PNmeSOok/IxIfjGNdDEJRgcjgkOzQXHpPK5crjG+Jmx5JYTN6eLrBRag1GcKTV1LgHr9hw0g3fopZ8aQ06tITVmQ= Received: by 10.65.97.5 with SMTP id z5mr1201978qbl; Fri, 30 Sep 2005 15:47:48 -0700 (PDT) Received: by 10.65.158.12 with HTTP; Fri, 30 Sep 2005 15:47:48 -0700 (PDT) Message-ID: Date: Fri, 30 Sep 2005 18:47:48 -0400 From: solarsail Reply-To: solarsail To: pgsql-sql@postgresql.org Subject: query tables based on a query MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6874_3277903.1128120468099" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.152 required=5 tests=[HTML_10_20=0.295, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024, RCVD_IN_BL_SPAMCOP_NET=1.832] X-Spam-Level: ** X-Archive-Number: 200510/23 X-Sequence-Number: 22876 ------=_Part_6874_3277903.1128120468099 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I have a large number of tables with a common naming convention basically: table001, table002, table003 ... table00n I would like to do a query across all of the tables, however I do not know all of the tables before hand, and I do not want to manually generate a query like select * from table001, table002, table003 I have a query that returns the names of the tables I want to query, it is basically like this: select tablename from pg_tables where tablename like 'table%' How do I do this? I've tried creating a Table Function that returns the above set and tried to use that in a select clause, but I cant get it to work either. Thanks for the help ------=_Part_6874_3277903.1128120468099 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I have a large number of tables with a common naming convention

basically:

      table001, table002, table003 ... table00n


I would like to do a query across all of the tables, however I do not know all of the tables before hand, and I do not want to manually generate a query like

     select * from table001, table002, table003


I have a query that returns the names of the tables I want to query, it is = basically like this:

   select tablename from pg_tables where tablename like 'table%'<= br>

How do I do this?  I've tried creating a Table Function that returns the above set and tried to use that in a select clause, but I cant get it to work either.


Thanks for the help

------=_Part_6874_3277903.1128120468099--