Re: Question on imports with foreign keys

From: "Emre Hasegeli" <emre(dot)hasegeli(at)tart(dot)com(dot)tr>
To: Andreas <maps(dot)on(at)gmx(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Question on imports with foreign keys
Date: 2011-12-09 09:39:07
Message-ID: op.v57ufhrjk2xoe5@tart-hasegeli-development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 08 Dec 2011 12:10:06 +0200, Andreas <maps(dot)on(at)gmx(dot)net> wrote:

> Lets's say there were already 1000 records in the customers table.
> Now I add 357 new customers to this table.
> If I use one of your queries I'd get all 1357 entries of customers
> since "project_x.projectinfos" would be newly created for this project
> and therefor empty.
> I need to know which customers.id was created for which line in the
> temporary table that I read in with copy.
> When I have those ids I can fill "project_x.projectinfos" with just
> those new 357 customer.ids and foreign keys refering the new
> lookup-tables.

Sorry, I do not understand exactly. What is the difference between the new
357 customers and the existent 1000 customers? If it is the date they
inserted, then the should be filtered by the date. If it is another
attribute like project they are related, then they should be filtered by
the project column or the relation table.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Klingler 2011-12-10 16:03:32 conditional FROM
Previous Message feng.zhou 2011-12-09 02:51:02 Re: Re: [SQL] Query Timeout Question