From: | Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com> |
---|---|
To: | darius(at)dons(dot)net(dot)au |
Cc: | "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #9652: inet types don't support min/max |
Date: | 2014-03-24 02:42:22 |
Message-ID: | CAJrrPGdeZpfTPR6EkGgM6A4bUG7BVVToXsMgqJ6rg7R1JRUPVg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
On Fri, Mar 21, 2014 at 5:17 PM, <darius(at)dons(dot)net(dot)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
Attachment | Content-Type | Size |
---|---|---|
inet_agg.patch | application/octet-stream | 5.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | amir baron | 2014-03-24 12:11:39 | Bug in PostgreSQL locking mechanism or misunderstanding of the mechanism |
Previous Message | Bruce Momjian | 2014-03-23 00:17:11 | Re: PQclientEncoding() returns -1, resulting in possible assertion failure in psql |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-03-24 04:54:31 | Re: Minimum supported version of Python? |
Previous Message | Etsuro Fujita | 2014-03-24 01:47:45 | Re: inherit support for foreign tables |