X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D47D4D1BA45; Fri, 5 Sep 2003 20:11:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 19340-07; Fri, 5 Sep 2003 17:11:11 -0300 (ADT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id 730B3D1E27A; Fri, 5 Sep 2003 16:37:16 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 3.35 #1) id 19vMOQ-000APQ-0W; Fri, 05 Sep 2003 20:37:15 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 3FC84173EE; Fri, 5 Sep 2003 20:37:14 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 95D0E173ED; Fri, 5 Sep 2003 20:37:13 +0100 (BST) From: Richard Huxton To: Neil Conway Subject: Re: [PERFORM] Seq scan of table? Date: Fri, 5 Sep 2003 20:37:12 +0100 User-Agent: KMail/1.5 Cc: Bjorn T Johansen , PostgreSQL General , PostgreSQL Performance References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> <200309051107.12756.dev@archonet.com> <1062786017.447.1.camel@tokyo> In-Reply-To: <1062786017.447.1.camel@tokyo> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200309052037.12689.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/468 X-Sequence-Number: 48690 On Friday 05 September 2003 19:20, Neil Conway wrote: > On Fri, 2003-09-05 at 06:07, Richard Huxton wrote: > > PG's parser will assume an explicit number is an int4 - if you need an > > int8 etc you'll need to cast it, yes. > > Or enclose the integer literal in single quotes. > > > You should find plenty of discussion of why in the archives, but the > > short reason is that PG's type structure is quite flexible which means it > > can't afford to make too many assumptions. > > Well, it's definitely a bug in PG, it's "quite flexible" type structure > notwithstanding. It certainly catches out a lot of people. I'd guess it's in the top three issues in the general/sql lists. I'd guess part of the problem is it's so silent. In some ways it would be better to issue a NOTICE every time a typecast is forced in a comparison - irritating as that would be. -- Richard Huxton Archonet Ltd