Re: Do we want a hashset type?

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Joel Jacobson <joel(at)compiler(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Do we want a hashset type?
Date: 2023-06-10 15:51:30
Message-ID: CACJufxG3EpkQWSvuZuoMYL4fXDLBEf5cGtNG6cTw8VsozXCEWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2023-06-10 16:12:36 Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
Previous Message Andrew Dunstan 2023-06-10 15:46:00 Re: Do we want a hashset type?