BUG #2006: queryoptimizer and comparing a primary key of biginteger and a literal

From: "Atanas Hristov" <atanashristov(at)hotmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2006: queryoptimizer and comparing a primary key of biginteger and a literal
Date: 2005-10-28 06:53:03
Message-ID: 20051028065303.F0DD5F0C2D@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2006
Logged by: Atanas Hristov
Email address: atanashristov(at)hotmail(dot)com
PostgreSQL version: 8.1 Beta 3
Operating system: FreeBSD 5
Description: queryoptimizer and comparing a primary key of biginteger
and a literal
Details:

foo=# CREATE TABLE foo (id BIGINT, CONSTRAINT foo_pk PRIMARY KEY(id) );

foo=# EXPLAIN ANALYZE SELECT 'foo' FROM foo WHERE id = CAST(0 AS BIGINT);
QUERY PLAN
----------------------------------------------------------------------------
--------------------------------
Index Scan using foo_pk on foo (cost=0.00..4.82 rows=2 width=0) (actual
time=0.113..0.113 rows=0 loops=1)
Index Cond: (id = 0::bigint)

foo=# EXPLAIN ANALYZE SELECT 'foo' FROM foo WHERE id = 0; -- WHY POSTGRES
DOES NOT IMPLICITLY DO CASTING OF THE LITERAL "0" ??????
QUERY PLAN
----------------------------------------------------------------------------
------------------
Seq Scan on foo (cost=0.00..22.50 rows=2 width=0) (actual
time=0.003..0.003 rows=0 loops=1)
Filter: (id = 0)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message A Gattiker 2005-10-28 11:39:14 BUG #2007: Problem with multiple JOIN and long IN and bitmap index
Previous Message Henning 2005-10-27 22:41:58 BUG #2004: SQL_COLUMN_AUTO_INCREMENT & SQL_DESC_AUTO_UNIQUE_VALUE not working