Re: Populate Table From Two Other Tables

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Populate Table From Two Other Tables
Date: 2012-06-06 02:15:21
Message-ID: 4FCEBD39.4030800@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/05/2012 04:49 PM, Rich Shepard wrote:
> On Tue, 5 Jun 2012, David Johnston wrote:
>
>> As for the duplicate key I would first check to see if you are inserting
>> into a non-empty table and that one or more of your newly inserted
>> records
>> conflicts with existing records on the waterchem table. The easiest way
>> would be to insert into a staging table and then join the staging and
>> live
>> tables together on the PK and see if any records are returned.
>
> David,
>
> Since the two separate tables have no duplicates I find it difficult to
> understand how combining the two generates a duplicate row.
>
> In any case, I always drop the table before running the script after
> correcting errors so there should not be a previous row with the same
> values. Puzzling,

Information that would be helpful:

The schema of the waterchem table

In particular, what is unique constraint "waterchem_pkey" a constraint on?

>
> Thanks,
>
> Rich
>
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Curvey 2012-06-06 02:20:25 Re: I'd like to learn a bit more about how indexes work
Previous Message Dann Corbit 2012-06-06 00:21:37 Re: I'd like to learn a bit more about how indexes work