From: Walt Bigelow <walt@stimpy.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] subqueries
Date: Tue, 13 Apr 1999 13:12:34 +0000 (Local time zone must be set--see zic manual page)
Message-ID: <Pine.LNX.3.96.990413130102.30435A-100000@alice.stimpy.com> (raw)
In-Reply-To: <27286.924017863@sss.pgh.pa.us>
On Tue, 13 Apr 1999, Tom Lane wrote:
> Walt Bigelow <walt@stimpy.com> writes:
> > SELECT agencyid, first, last
> > FROM tbladdress
> > WHERE type = 1
> > AND agencyid NOT IN
> > (SELECT distinct agencylink
> > FROM tbladdress
> > WHERE type = 2)
> > ORDER BY last;
>
> Looks reasonable ...
>
> > This query returns 0 rows [ when it shouldn't ].
>
> Sounds like a bug. What version of Postgres are you running?
> What do you get from "EXPLAIN"ing that query? What are the
> data types of the columns being used?
>
Tom,
I am using postgres 6.4.2 on a RH5.1 SMP box.
The output of explain:
NOTICE: QUERY PLAN:
Seq Scan on tbladdress (cost=50.34 size=348 width=24)
SubPlan
-> Unique (cost=50.34 size=0 width=0)
-> Sort (cost=50.34 size=0 width=0)
-> Seq Scan on tbladdress (cost=50.34 size=348 width=4)
EXPLAIN
The data types are int4 for both agencyid and agencylink. And there are
about 800 rows total of 5 different types. (the type field is int4 as
well)
Thanks again,
Walt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: walt@stimpy.com, tgl@sss.pgh.pa.us, pgsql-sql@hub.org
Subject: Re: [SQL] subqueries
In-Reply-To: <Pine.LNX.3.96.990413130102.30435A-100000@alice.stimpy.com>
References: <27286.924017863@sss.pgh.pa.us> <Pine.LNX.3.96.990413130102.30435A-100000@alice.stimpy.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox