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 6A4EBDA141 for ; Wed, 5 Oct 2005 05:25:29 -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 41509-01 for ; Wed, 5 Oct 2005 08:25:21 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 4EA44D8F1A for ; Wed, 5 Oct 2005 05:25:22 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id A5A7E40BB1D; Wed, 5 Oct 2005 09:25:18 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 03E1C15EDB; Wed, 5 Oct 2005 09:22:38 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11574-02; Wed, 5 Oct 2005 09:22:31 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id B34C915EDA; Wed, 5 Oct 2005 09:20:50 +0100 (BST) Message-ID: <43438CE2.3080108@archonet.com> Date: Wed, 05 Oct 2005 09:20:50 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050912) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott cox Cc: pgsql-sql@postgresql.org Subject: Re: creating postgres tables by passing a string to function References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 required=5 tests=[AWL=0.008, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/28 X-Sequence-Number: 22881 Scott cox wrote: > I am storing data separated by month. > How do I perform Inserts and Selects based on something like this. > > select * from (select 'shipped' || '0509') AS aShippingTable > > The table 'shipped' || '0509' exists. > > I am scanning barcode labels which have the '0509' on them and I want to > move the data > to appropiate monthly tables. '0510' would represent shipped on 2005 > october. > > Eventually I want to create, insert, select all based on passing a > string such as '0509' to a function. Well, it sounds like you want to look at the EXECUTE command if you're thinking of writing functions in plpgsql. However, you don't say how you came to the conclusion that separating your shipping-table into hundreds of smaller tables was the best design. Can I ask what testing you did and what the results were? -- Richard Huxton Archonet Ltd