Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7F82F2E0048 for ; Wed, 21 Nov 2007 04:34:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 87198-02 for ; Wed, 21 Nov 2007 04:34:19 -0400 (AST) Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.131]) by postgresql.org (Postfix) with ESMTP id 368622E0037 for ; Wed, 21 Nov 2007 04:34:19 -0400 (AST) Received: from [84.51.143.99] (helo=server3.office.archonet.com) by pih-relay04.plus.net with esmtp (Exim) id 1Iul2J-00037H-CI; Wed, 21 Nov 2007 08:34:19 +0000 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id C90AE274075; Wed, 21 Nov 2007 08:34:17 +0000 (GMT) Message-ID: <4743ED89.5080504@archonet.com> Date: Wed, 21 Nov 2007 08:34:17 +0000 From: Richard Huxton User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: Dane Springmeyer CC: Postgres General List Subject: Re: Normalization tools for postgres? References: <597066.69415.qm@web31806.mail.mud.yahoo.com> <0ED7C703-6F0A-46DC-93D3-244C9FADE5A5@hailmail.net> In-Reply-To: <0ED7C703-6F0A-46DC-93D3-244C9FADE5A5@hailmail.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/1119 X-Sequence-Number: 124115 Please don't start a new thread by replying to another question. If you are going to do that, please don't cross-post it in addition. This doesn't appear to be anything to do with PHP. Dane Springmeyer wrote: > Anyone have recommendations on tools/utilities or SQL approaches to > quickly break apart a large imported flat file into normal forms, > ideally 1NF or 2NF? I don't know of any tool that could do this automatically. Without understanding what the columns *mean* how could it. > I noticed this tool for mySQL which captures what I am looking for: > http://www.sqldbu.com/eng/sections/tips/normalize.html Well, given that the example just shows the author doesn't know what 1NF means, I don't think it does do what you want. > Given the fields with data to be output into separate tables, it takes a > csv and automatically generates a set of INSERT queries to build all the > related tables with new a new primary key for the main table and > serialized codes for each of the new tables to maintain relationships. I don't see any reason why the INSERTs won't work for PG just as well. > Perhaps a customized php script could accomplish the same thing for > postgres? > > Any suggestions would be helpful. Can you state what problem you are trying to solve? Do people just email you flat files and ask you to send them a relational database back? Is there a specific file that gets imported on a regular basis? -- Richard Huxton Archonet Ltd