Re: BigInt woes

From: Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)in>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BigInt woes
Date: 2003-10-08 06:35:53
Message-ID: 3F83B049.8020900@persistent.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joshua D. Drake wrote:

> Hello,
>
> I believe that the Int8/BigInt items are known issues but I have a knew
> programmer that ran into it
> over the weekend (he didn't call me when he encountered the problem,
> when he should of) and we have a
> customer that burned some significant time on it as well. Will this be
> fixed in 7.4?

Well, this is not an issue actually but fact that postgresql is very strict
about it's data types. You need to cast explicitly even for those types which
'seem' compatible, such as int4 and int2.

> This query:
>
> explain select bid_id, bid_time from bid where bid_id = 10000
>
> Will always sequential scan.
>
> This query:
>
> explain select bid_id, bid_time from bid where bid_id = '10000'

Try explain select bid_id, bid_time from bid where bid_id = 10000::bigint

> create function bid_check(bigint) returns bool as '
> declare
> in_bid_id alias for $1;
> begin
>
> if (select count(*) from bid where bid_id = in_bid_id) = 1 then

Again try typecasting.

if (select count(*) from bid where bid_id::bigint = in_bid_id::bigint) = 1 then

I doubt in_bid_id needs to be casted that explicitly but I am sure it will be
safe..:-)

HTH

Shridhar

In response to

  • BigInt woes at 2003-10-07 16:57:20 from Joshua D. Drake

Browse pgsql-hackers by date

  From Date Subject
Next Message Allie Micka 2003-10-08 06:52:06 Possible Bug in 7.3.2 on OS X
Previous Message Bruce Momjian 2003-10-08 04:44:45 Re: [HACKERS] pg_restore -d doesn't display output