Re: Do we want a hashset type? - Mailing list pgsql-hackers

From jian he
Subject Re: Do we want a hashset type?
Date
Msg-id CACJufxG3EpkQWSvuZuoMYL4fXDLBEf5cGtNG6cTw8VsozXCEWA@mail.gmail.com
Whole thread Raw
In response to Re: Do we want a hashset type?  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Do we want a hashset type?
List 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")));

 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 by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Do we want a hashset type?
Next
From: Hannu Krosing
Date:
Subject: Re: Let's make PostgreSQL multi-threaded