Re: Do we want a hashset type?
| От | jian he | 
|---|---|
| Тема | Re: Do we want a hashset type? | 
| Дата | |
| Msg-id | CACJufxG3EpkQWSvuZuoMYL4fXDLBEf5cGtNG6cTw8VsozXCEWA@mail.gmail.com обсуждение исходный текст | 
| Ответ на | Re: Do we want a hashset type? (Andrew Dunstan <andrew@dunslane.net>) | 
| Ответы | Re: Do we want a hashset type? | 
| Список | pgsql-hackers | 
in funcion. hashset_in 
int32 value = strtol(str, &endptr, 10);
there is no int32 value range check? 
imitate src/backend/utils/adt/int.c. the following way is what I came up with.
int64 value = strtol(str, &endptr, 10);
if (errno == ERANGE || value < INT_MIN || value > INT_MAX)
ereturn(fcinfo->context, (Datum) 0,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("value \"%s\" is out of range for type %s", str,
"integer")));
if (errno == ERANGE || value < INT_MIN || value > INT_MAX)
ereturn(fcinfo->context, (Datum) 0,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("value \"%s\" is out of range for type %s", str,
"integer")));
 set = hashset_add_element(set, (int32)value);
also it will infinity loop in hashset_in if supply the wrong value.... 
example select  '{1,2s}'::hashset;
I need kill -9 to kill the process. 
В списке pgsql-hackers по дате отправления: