Skip site navigation (1) Skip section navigation (2)

using a join in an 'INSERT ... SELECT' ...

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: using a join in an 'INSERT ... SELECT' ...
Date: 2000-09-14 04:18:02
Message-ID: Pine.BSF.4.21.0009140113440.79147-100000@thelab.hub.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Okay, logically I think this makes sense, but its not working ... should
it?

globalmatch=# insert into auth_info_new
globalmatch-# select ai.* from auth_info ai, auth_info_new ain
globalmatch-# where ai.username != ain.username;
INSERT 0 0

auth_info has 14k tuples, but some are duplicates ... I want to insert
into auth_info_new everything except those that have already been inserted
into auth_info_new ...

now, my first thought looking at the above would be that since
auth_info_new is empty, all from auth_info should be copied over ...
basically, since each tuple isn't "committed" until the insert is
finished, then every username in ai is definitely not in ain ... but
nothing is being copied over, so my first thought is definitely wrong ...

bug? *raised eyebrow*  

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy(at)hub(dot)org           secondary: scrappy(at){freebsd|postgresql}.org 


Responses

pgsql-hackers by date

Next:From: Thomas LockhartDate: 2000-09-14 05:03:41
Subject: Re: Indexing of LIKE queries is broken in current sources
Previous:From: Philip WarnerDate: 2000-09-14 04:13:32
Subject: Re: pg_dump of regression db?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group