Re: BUG #9652: inet types don't support min/max
От | Haribabu Kommi |
---|---|
Тема | Re: BUG #9652: inet types don't support min/max |
Дата | |
Msg-id | CAJrrPGdeZpfTPR6EkGgM6A4bUG7BVVToXsMgqJ6rg7R1JRUPVg@mail.gmail.com обсуждение исходный текст |
Ответ на | BUG #9652: inet types don't support min/max (darius@dons.net.au) |
Ответы |
Re: BUG #9652: inet types don't support min/max
|
Список | pgsql-bugs |
On Fri, Mar 21, 2014 at 5:17 PM, <darius@dons.net.au> wrote: > The following bug has been logged on the website: > reclog=> select * from foo; > bar > --------- > 1.2.3.4 > (1 row) > > reclog=> select min(bar) from foo; > ERROR: function min(inet) does not exist > LINE 1: select min(bar) from foo; > ^ > HINT: No function matches the given name and argument types. You might need > to add explicit type casts. > > This is surprising to me since the inet type is ordered, hence min/max are > possible. In the code, some comparison logic for the inet datatypes already present. With those I thought it is easy to support the min and max aggregates also. So I modified the code to support the aggregate functions of min and max by using the already existing inet comparison logic. Is there anything I am missing? postgres=# create table tbl(f inet); CREATE TABLE postgres=# insert into tbl values('1.2.3.5'); INSERT 0 1 postgres=# insert into tbl values('1.2.3.4'); INSERT 0 1 postgres=# select min(f) from tbl; min --------- 1.2.3.4 (1 row) postgres=# select max(f) from tbl; max --------- 1.2.3.5 (1 row) Patch is attached. This is the first time I am touching this area so please let me know your suggestions. Regards, Hari Babu Fujitsu Australia
Вложения
В списке pgsql-bugs по дате отправления: