Thread

  1. Re: Unsigned ints (Help)

    Adriaan Joubert <a.joubert@albourne.com> — 2001-03-28T15:41:18Z

    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
    'float8'
            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
    option.
    
    Cheers!
    
    Adriaan