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

BUG #2503: Query results differ based on record count of unrelated table.

From: "Russell Francis" <rfrancis(at)ev(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2503: Query results differ based on record count of unrelated table.
Date: 2006-06-28 18:51:45
Message-ID: 200606281851.k5SIpjS9096836@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2503
Logged by:          Russell Francis
Email address:      rfrancis(at)ev(dot)net
PostgreSQL version: 8.1.4
Operating system:   FreeBSD 6.1
Description:        Query results differ based on record count of unrelated
table.
Details: 

Summary:

If a SELECT statement contains a table in it's FROM clause which has 0
records in it, the query will not return any results.  If a record is added
to the table even though it shouldn't modify the results of query, the query
will return the expected result.

The SQL statements below are a trimmed down test case which duplicates this
issue.  The identical SELECT statements return different results depending
on the record count of the unrelated table_b.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

CREATE TABLE table_a
(
	ta_col_a	INTEGER
);

CREATE TABLE table_b
(
	tb_col_a	INTEGER
);

INSERT INTO table_a ( ta_col_a ) VALUES ( 50 );

SELECT table_a.* FROM table_a, table_b WHERE table_a.ta_col_a > 0;

INSERT INTO table_b ( tb_col_a ) VALUES ( 50 );

SELECT table_a.* FROM table_a, table_b WHERE table_a.ta_col_a > 0;

Responses

pgsql-bugs by date

Next:From: some.oneDate: 2006-06-28 21:20:48
Subject: BUG #2504: Major MS SQL Server bug
Previous:From: J. R. FisherDate: 2006-06-28 17:41:02
Subject: BUG #2502: PQclear: "invalid next size"

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