X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E89769FA5CE for ; Tue, 13 Jun 2006 20:23:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 45586-03 for ; Tue, 13 Jun 2006 20:23:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from weatherbeeta.com.au (mail.weatherbeeta.com.au [202.154.127.242]) by postgresql.org (Postfix) with SMTP id AB6A19FA38F for ; Tue, 13 Jun 2006 20:23:21 -0300 (ADT) Received: (qmail 12965 invoked from network); 13 Jun 2006 23:23:19 -0000 X-NetworkBox-HamSign: 0101;OUT;wbeetaau1;bc95c334273348a3c4a4169679d723ff; Received: from mail.weatherbeeta.com.au (HELO wb-email) (172.20.0.2)by network-box.weatherbeeta.com.au with SMTP; 13 Jun 2006 23:23:18 -0000 Received: from IT-PHIL ([172.20.0.155]) by wb-email (602Pro LAN SUITE 2003) id 2d52ff02 for pgsql-sql@postgresql.org; Wed, 14 Jun 2006 9:20:53 +1000 Reply-To: From: "Phillip Smith" Cc: Subject: Re: COPY to table with array columns (Longish) Date: Wed, 14 Jun 2006 09:22:30 +1000 Organization: Weatherbeeta P/L Message-ID: <003201c68f40$3e392850$9b0014ac@ITPhil> MIME-Version: 1.0 Content-Type: text/plain;charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 In-Reply-To: Importance: Normal X-Scanned-By-wbeetaau1: Virus scan performed by network-box X-Scanned-By-wbeetaau1: Scanner file id is wbeetaau1-1150240998.863-12957-000 X-Scanned-By-wbeetaau1: No known viruses found in message (received+scanned in 0.03/0.07 secs) X-Scanned-By-wbeetaau1: Spam-Check-Result: No, hits=0 required=7 tests= autolearn=no version=2.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/141 X-Sequence-Number: 25377 Thanks Aaron - There are currently 8175 records in my SYS file - I might need to go with this approach but be selective about which items I = export so I don't end up with 8000 tables related to SYS! There's probably a lot = of **** in there that doesn't actually need to be exported. Thanks again, -p -----Original Message----- From: pgsql-sql-owner@postgresql.org = [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Aaron Bono Sent: Wednesday, 14 June 2006 1:05 AM To: phillips@weatherbeeta.com.au Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY to table with array columns (Longish) So how about creating a sys table too: SYS sys_id ZKCOST sys_id, zkcost_id, zkcost_value and ZPRECMPL sys_id, zprecmpl_id, zprecmpl_value This gives you the flexibility to expand to as many "columns" for ZPRECMPL as you want. The bottom line is, I think it would be much more efficient storage to determine a way to turn your variable number of columns into rows of a value table. For example, I have a web site for role playing games. Since each game has different attributes for the characters you play, I need a flexible way to define the list of attributes and then allow people to enter the values of those attributes. Below is a simplified version of my table structure: attribute attribute_id (PK), attribute_name character character_id (PK), character_name character_attribute character_attribute_id (PK), character_id (FK), attribute_id (FK), value It is a little different than your problem but demonstrates how a variable number of columns (in this case a variable number of attributes for a character) can be stored with one row representing each column. Because I don't understand the context of your problem as well as you do, you will probably have to determine how to tweak this to meet your needs. But I think, from the information you have provided, that this "pivoted" table approach will work for you. -Aaron On 6/13/06, Phillip Smith wrote: > Not quite... ZKCOST and ZPRECMPL are two completely different things. = They > have no relation except they're both stored in the SYS table in D3. > > If we put it in a tree: > SYS > | > +- ZKCOST > | \- > | > +- ZPRECMPL > | +- > | +- > | +- > | \- > > or table: > SYS > +-----------+---------+---------+---------+---------+ > | ZKCOST | | | | | > | ZPRECMPL | | | | | > +-----------+---------+---------+---------+---------+ ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments