Re: Establishing a primary key

From: Charles Simard <tech(at)denarius(dot)ca>
To: 'Bob Pawley' <rjpawley(at)shaw(dot)ca>
Cc: 'Postgresql' <pgsql-general(at)postgresql(dot)org>
Subject: Re: Establishing a primary key
Date: 2007-06-22 19:40:45
Message-ID: E6AE5AD88D55B543A0A97FF0B93AA9E93C3060@TRADE200.DENARIUS.CA
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Bob Pawley
> Sent: 22 juin 2007 14:15
> To: Postgresql
> Subject: [GENERAL] Establishing a primary key
>
>
> I have numerous entries in a column of table 1, some of which are
duplicated.
>
> I need to transfer this information to table 2 so that I have column that
can be used as a primery key.
>
> Any help is appreciated.
>
> Bob Pawley

Something like:

Table1{
col1 text,
col2 text
}

Table2{
idtable2 serial,
col1 text,
col2 text,
primary key (idtable2)
}

INSERT INTO Table2 (col1, col2) SELECT col1, col2 FROM Table1;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Henk - CityWEB 2007-06-22 20:16:00 Re: 8.2.3 PANIC with "corrupted item pointer"
Previous Message Michael Glaesemann 2007-06-22 19:37:35 Re: B-tree fan-out