Re: Unsigned ints (Help)

Поиск
Список
Период
Сортировка
От Adriaan Joubert
Тема Re: Unsigned ints (Help)
Дата
Msg-id 3AC2061E.9C0F11A3@albourne.com
обсуждение исходный текст
Ответ на Unsigned ints  (Adriaan Joubert <a.joubert@albourne.com>)
Ответы Re: Unsigned ints (Help)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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
'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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Lamar Owen
Дата:
Сообщение: Re: 7.1 RC1 RPM
Следующее
От: Joel Burton
Дата:
Сообщение: Re: Feature Request: ALTER FUNCTION (or something like that)