Re: create table as problem

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Frances Collier <fcollier(at)preparedresponse(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: create table as problem
Date: 2005-10-07 00:29:33
Message-ID: 20051007002933.GA19015@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Sep 28, 2005 at 10:07:34 -0700,
Frances Collier <fcollier(at)preparedresponse(dot)com> wrote:
> I am trying to copy some rows from a table to another table using "create
> table as" but I keep getting a "column name 'ogc_fid' is duplicated" error.
> Can anyone tell me why this is happening?

You need to have unique column names. Since wacounties is joined to itself
every column name will appear twice. You need to qualify them.
I think you could use a.*, b.* if you really don't want to write out the
full column names.

>
>
>
> The postgres statement:
>
>
>
> create table skamaniaTable as
>
> select *
>
> from wacounties a,
>
> wacounties b
>
> where b.county_nm='Skamania' and
>
> a.wkb_geometry && b.wkb_geometry and
>
> distance(a.wkb_geometry, b.wkb_geometry) = 0;
>
>
>
> The table fields:
>
>
>
> ogc_fid :: int, wkb_geometry :: geometry, area :: float, perimeter :: float,
> wacounties :: int, wacounti_1 :: int, county_cod :: int, county_fip ::
> varchar, county_nm :: varchar, ecy_region :: varchar, air_region :: varchar,
> shape_leng :: float, shape_area :: float
>
>
>
> Any help would be greatly appreciated.
>
>
>
> Thank you,
>
> Frances Collier
>
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2005-10-07 00:32:33 Re: create table as problem
Previous Message Daniel T. Staal 2005-10-06 19:08:58 Re: Missing file LIBC06P1