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

Re: Unsigned ints (Help)

From: Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>
To: Postgresql <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unsigned ints (Help)
Date: 2001-03-28 15:41:18
Message-ID: (view raw or whole thread)
Lists: pgsql-hackers
Uggh, this needs some help. I've got the problem that I can insert a
value bigger than MAXINT into an int8 column, but when I try to do the
same for a uint4 column, the parser coerces it into an int4, as in:

test=# insert into tint8 values (3043140617);
INSERT 30254 1
test=# insert into tuint4 values (3043140617);
ERROR:  Attribute 'a' is of type 'uint4' but expression is of type
        You will need to rewrite or cast the expression
test=# insert into tuint4 values (3043140617::uint4);
INSERT 30255 1

Apparently this happens in parse_target.c, from where it calls
CoerceTargetExpr from where it calls routines in parse_coerce.c.

At this point I decided that somewhere in the definition of the type
there must be a way of specifying how values can be transformed. Can
anybody explain to me what I need to change to make this work? Without
this ecpg cannot work with unsigned ints, so explicit casting is not an



In response to


pgsql-hackers by date

Next:From: Joel BurtonDate: 2001-03-28 15:52:28
Subject: Re: Feature Request: ALTER FUNCTION (or something like that)
Previous:From: Tom LaneDate: 2001-03-28 15:22:56
Subject: Re: pg_dump potential bug

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