Re: Adding missing FROM-clause entry in subquery - Mailing list pgsql-general

From Robert Treat
Subject Re: Adding missing FROM-clause entry in subquery
Date
Msg-id 1065112863.16666.1346.camel@camel
Whole thread Raw
In response to Adding missing FROM-clause entry in subquery  (<btober@seaworthysys.com>)
Responses Re: Adding missing FROM-clause entry in subquery
List pgsql-general
On Thu, 2003-10-02 at 08:58, btober@seaworthysys.com wrote:
>
> INSERT INTO report (
>   SELECT * FROM temptable s1 EXCEPT
>   SELECT * FROM report s2 WHERE s2.title = report.title);
>

i think you're essentially doing:

INSERT INTO report (
    SELECT * FROM temptable s1 EXCEPT
    SELECT * FROM report s2, report WHERE s2.title = report.title);

which i don't think is what you expected to happen*, but seems to be
pretty much equivalent in this case.



*given that missing-from behaves differently with inserts and updates, i
can see how this is pretty confusing... in 7.4 theres an option to turn
this off, though you'd need to think of another way to do what your
doing above since it would break


Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: return next in recursive function
Next
From: "Roberto de Amorim"
Date:
Subject: Case Tool for PostgreSQL