Re: Adding missing FROM-clause entry in subquery

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: btober(at)seaworthysys(dot)com
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Adding missing FROM-clause entry in subquery
Date: 2003-10-02 16:41:03
Message-ID: 1065112863.16666.1346.camel@camel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2003-10-02 at 08:58, btober(at)seaworthysys(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Seeger 2003-10-02 16:56:33 Re: Can anyone recommend a good PostGres admin tool?
Previous Message Tom Lane 2003-10-02 15:12:11 Re: return next in recursive function