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

BUG #1608: integer negative limit in plpgsql function arguments

From: "Paul" <paul(at)allinea(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1608: integer negative limit in plpgsql function arguments
Date: 2005-04-20 14:46:51
Message-ID: 20050420144651.3BDEAF0F4C@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1608
Logged by:          Paul
Email address:      paul(at)allinea(dot)com
PostgreSQL version: 8.0.2
Operating system:   Gentoo and Fedora Core 3
Description:        integer negative limit in plpgsql function arguments
Details: 

The script below best sums up the problem (and the work around).  The
question is: should I use that for all integers being put into a function?

8<--------------------------------------------

create table test (
	test_id integer
);

insert into test (test_id) values (-2147483648);

create function print_test_id (integer) returns integer
	AS '
DECLARE
	tmp ALIAS FOR $1;
	val integer;
BEGIN
	select into val test_id from test where test_id = tmp;
	return val;
END;
'
	LANGUAGE plpgsql;

-- this doesn't work (and I think it should!)
SELECT print_test_id(-2147483648);

-- this is the workaround
SELECT print_test_id((-2147483648)::int);

-------------------------------------------->8

Responses

pgsql-bugs by date

Next:From: Oliver SiegmarDate: 2005-04-20 15:04:32
Subject: BUG #1609: Bug in interval datatype for 64 Bit timestamps
Previous:From: sawaitDate: 2005-04-20 08:47:01
Subject: Re: BUG #1605: Is this a bug of PostgreSQL?Or, is the parameter of Windows set?

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