From: | Andreas <maps(dot)on(at)gmx(dot)net> |
---|---|
To: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Question on imports with foreign keys |
Date: | 2011-12-08 06:48:51 |
Message-ID: | 4EE05DD3.2080308@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
suppose you need to import a csv with standard ciolums like name,
adress, phone, ... and some additional text columns that need to be
split off into referenced tables.
Those lookup-tables will only be needed for a project with limited life
time so I create a schema that might be called "project_x". There I
create the necessary lookup tables.
The core of the import will be added to the customers table with
unlimited livespan. The customers table has a PKey id which is a serial.
I don't want to add FKey columns into customers for the new
lookup-tables so I create another table in project_x "projectinfos" that
stores those FKeys and another FKey that references customers.id.
First question: Is this a stupid aproach?
If not:
How is the easiest way to to find the customer.id of the new customers
so I can insert the projectinfos?
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2011-12-08 07:40:04 | Re: prepared statements |
Previous Message | feng.zhou | 2011-12-08 04:18:11 | Re: Re: [SQL] No response from the backend |