Re: maxint reached?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Kalchev <daniel(at)digsys(dot)bg>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: maxint reached?
Date: 2002-04-02 21:06:27
Message-ID: 27814.1017781587@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Kalchev <daniel(at)digsys(dot)bg> writes:
> It turned out to be an query containing "oid = somenumber" called from perl script. Is it possible that the default type conversion functions do not work as expected?

No, but you do have to cast an oversize value to oid explicitly to
prevent it from being taken as int4, eg

regression=# select oid = 2444444444 from int4_tbl;
ERROR: dtoi4: integer out of range
regression=# select oid = 2444444444::oid from int4_tbl;
<< works >>

(In releases before about 7.1 you'd have had to single-quote the
literal, too.)

This is one of a whole raft of cases involving undesirable assignment
of types to numeric constants; see past complaints about int4 being used
where int2 or int8 was wanted, numeric vs float8 constants, etc etc.
We're still looking for a promotion rule that does what you want every
time...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Kalchev 2002-04-02 21:10:53 Re: maxint reached?
Previous Message Jean-Michel POURE 2002-04-02 20:56:55 Re: [HACKERS] Unicode ready?