Re: Copy Data Question - Mailing list pgsql-novice

From
Subject Re: Copy Data Question
Date
Msg-id 20060622215447.73314.qmail@web33301.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Copy Data Question  (Richard Broersma Jr <rabroersma@yahoo.com>)
Responses Re: Copy Data Question  (Richard Broersma Jr <rabroersma@yahoo.com>)
List pgsql-novice
> > how can i add *only* nonexisting entries to my db
> > tables (iow, if it is one of the 100+ there now, i
> > don't want to mess with it)?
>
> I will take a stab at the easy question. Out of test
> solutions, this is the one that I know.
>
> 1. create a temp table using destination table
> schema using the LIKE clause.
>
http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html
>
> 2. import external data into the temp table.
>
> 3. select into destinationtable from temptable where
> temptable.primarykey not exists
> ( select destinationtable.primarykey
>    from destination table
> );

Richard, thanks.  in my case, the primary key isn't
relevant, however, the product_number is (it is
unique).  iiuc, in my case i should use product_number
instead of primarykey.

it makes sense - thanks for the enlightenment.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

pgsql-novice by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: Copy Data Question
Next
From: Richard Broersma Jr
Date:
Subject: Re: Copy Data Question