Re: Populate Table From Two Other Tables

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Populate Table From Two Other Tables
Date: 2012-06-05 23:28:20
Message-ID: alpine.LNX.2.00.1206051623570.27613@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 5 Jun 2012, Greg Williamson wrote:

> Try a single equals sign, e.g. WHERE c.site = s.siteid

Greg,

I'm surprised: that worked! I thought the WHERE clause was looking for
equivalency, not an assignment.

There's another problem now that will be more difficult to fix. Postgres
tells me, 'psql:populate-waterchem.sql:6: ERROR: duplicate key value
violates unique constraint "waterchem_pkey"'. But, when I SELECT rows based
on the primary key only a single row is returned.

I think the most parsimonious solution is to use an awk script to add the
stream and basin columns to the chemistry.txt file. That also eliminates
having to export the combined table to a text file.

Thanks,

Rich

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Christensen 2012-06-05 23:28:29 Re: I'd like to learn a bit more about how indexes work
Previous Message Kraus Philipp 2012-06-05 23:15:36 acessibility for tables