Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WrugJ-00030k-AR for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Jun 2014 19:47:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WrugI-0002e7-Oi for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Jun 2014 19:47:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WrugH-0002dy-M1 for pgsql-bugs@postgresql.org; Tue, 03 Jun 2014 19:47:33 +0000 Received: from mail-qa0-f54.google.com ([209.85.216.54]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1WrugC-0003P5-7b for pgsql-bugs@postgresql.org; Tue, 03 Jun 2014 19:47:32 +0000 Received: by mail-qa0-f54.google.com with SMTP id j15so5483136qaq.41 for ; Tue, 03 Jun 2014 12:47:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=edc0gyJ1VEY4Td5QRUAFCOOcZ56BKgQY8eJqUSvy4g8=; b=SYfuTJcKvRzNRkJK4JnI49hYy9LX5COMIYE0j/pmGYdcCjhdwToCvSWDZm4/qU5AA5 zdcpvFECqkDkfFPz7FKDjxX6AVgscjHsRzRvfVryHeKQBtTFCjVrjbrt4swfVAuuIPYA qHEVYXndHPYyCqtCJK89VsVlLjWP0MRJOvLk1wUILfr2Pb/V5yUotFDFOfxGW+/rJsmR qVAPPXwSWNsfD9NQCy6uj60hz32b+0stxeEkDs0s9gC+CwYjaHSVG1k4njGaApgctDVe FQ9EI8xllXXV4fNWVlGzhDtRJ/lzAHMyD5BbiyDvIBeKpv035xx+qLOLRltrXRPUI+FM nfyw== X-Gm-Message-State: ALoCoQk7NEhpQRSHmheaVymxW4YV7PChn8JNkp+BF1ZIxzod4A0octN9b30LtpD0QfMtdN9nY38d X-Received: by 10.224.11.70 with SMTP id s6mr64748797qas.65.1401824845821; Tue, 03 Jun 2014 12:47:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.172.69 with HTTP; Tue, 3 Jun 2014 12:46:45 -0700 (PDT) In-Reply-To: <20140603144824.GE1220@awork2.anarazel.de> References: <20140321061735.28629.38477@wrigleys.postgresql.org> <20140603095139.GK24145@awork2.anarazel.de> <12477.1401805486@sss.pgh.pa.us> <20140603142733.GD1220@awork2.anarazel.de> <12773.1401806273@sss.pgh.pa.us> <20140603144824.GE1220@awork2.anarazel.de> From: Keith Fiske Date: Tue, 3 Jun 2014 15:46:45 -0400 Message-ID: Subject: Re: [HACKERS] BUG #9652: inet types don't support min/max To: Andres Freund Cc: Tom Lane , Haribabu Kommi , "Daniel O'Connor" , "pgsql-bugs@postgresql.org" , "pgsql-hackers@postgresql.org" Content-Type: multipart/alternative; boundary=001a11c2c5a6f90fee04faf3c7de X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --001a11c2c5a6f90fee04faf3c7de Content-Type: text/plain; charset=UTF-8 On Tue, Jun 3, 2014 at 10:48 AM, Andres Freund wrote: > On 2014-06-03 10:37:53 -0400, Tom Lane wrote: > > Andres Freund writes: > > > On 2014-06-03 10:24:46 -0400, Tom Lane wrote: > > >> Personally, I would wonder why the regression tests contain such a > query > > >> in the first place. It seems like nothing but a major maintenance > PITA. > > > > > I haven't added it, but it seems appropriate in that specific case. The > > > number of leakproof functions should be fairly small and every addition > > > should be carefully reviewed... I am e.g. not sure that it's a good > idea > > > to declare network_smaller/greater as leakproof - but it's hard to > catch > > > that on the basic of pg_proc.h alone. > > > > Meh. I agree that new leakproof functions should be carefully reviewed, > > but I have precisely zero faith that this regression test will contribute > > to that. > > Well, I personally wouldn't have noticed that the OP's patch marked the > new functions as leakproof without that test. At least not while looking > at the patch. pg_proc.h is just too hard to read. > > > It hasn't even got a comment saying why changes here should > > receive any scrutiny; moreover, it's not in a file where changes would be > > likely to excite suspicion. (Probably it should be in opr_sanity, if > > we're going to have such a thing at all.) > > I don't object to moving it there. > > Greetings, > > Andres Freund > > -- > Andres Freund http://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Training & Services > Andres's changes on June 3rd to https://github.com/postgres/postgres/commits/master/src/test/regress/expected/create_function_3.out are causing patch v2 to fail for that regression test file. postgres $ patch -p1 -i ../inet_agg_v2.patch patching file src/backend/utils/adt/network.c patching file src/include/catalog/pg_aggregate.h patching file src/include/catalog/pg_proc.h patching file src/include/utils/builtins.h patching file src/test/regress/expected/create_function_3.out Hunk #1 FAILED at 153. 1 out of 1 hunk FAILED -- saving rejects to file src/test/regress/expected/create_function_3.out.rej patching file src/test/regress/expected/inet.out patching file src/test/regress/sql/inet.sql Otherwise it applies without any issues to the latest HEAD. I built and started a new instance, and I was able to test at least the basic min/max functionality keith=# create table test_inet (id serial, ipaddress inet); CREATE TABLE Time: 25.546 ms keith=# insert into test_inet (ipaddress) values ('192.168.1.1'); INSERT 0 1 Time: 3.143 ms keith=# insert into test_inet (ipaddress) values ('192.168.1.2'); INSERT 0 1 Time: 2.932 ms keith=# insert into test_inet (ipaddress) values ('127.0.0.1'); INSERT 0 1 Time: 1.786 ms keith=# select min(ipaddress) from test_inet; min ----------- 127.0.0.1 (1 row) Time: 3.371 ms keith=# select max(ipaddress) from test_inet; max ------------- 192.168.1.2 (1 row) Time: 1.104 ms -- Keith Fiske Database Administrator OmniTI Computer Consulting, Inc. http://www.keithf4.com --001a11c2c5a6f90fee04faf3c7de Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Tue, Jun 3, 2014 at 10:48 AM, Andres Freund <andres@2ndquadrant.co= m> wrote:
On 2014-0= 6-03 10:37:53 -0400, Tom Lane wrote:
> Andres Freund <andres@2nd= quadrant.com> writes:
> > On 2014-06-03 10:24:46 -0400, Tom Lane wrote:
> >> Personally, I would wonder why the regression tests contain s= uch a query
> >> in the first place. =C2=A0It seems like nothing but a major m= aintenance PITA.
>
> > I haven't added it, but it seems appropriate in that specific= case. The
> > number of leakproof functions should be fairly small and every ad= dition
> > should be carefully reviewed... I am e.g. not sure that it's = a good idea
> > to declare network_smaller/greater as leakproof - but it's ha= rd to catch
> > that on the basic of pg_proc.h alone.
>
> Meh. =C2=A0I agree that new leakproof functions should be carefully re= viewed,
> but I have precisely zero faith that this regression test will contrib= ute
> to that.

Well, I personally wouldn't have noticed that the OP's patch = marked the
new functions as leakproof without that test. At least not while looking at the patch. pg_proc.h is just too hard to read.

> It hasn't even got a comment saying why changes here should
> receive any scrutiny; moreover, it's not in a file where changes w= ould be
> likely to excite suspicion. =C2=A0(Probably it should be in opr_sanity= , if
> we're going to have such a thing at all.)

I don't object to moving it there.

Greetings,

Andres Freund

--
=C2=A0Andres Freund =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 ht= tp://www.2ndQuadrant.com/
=C2=A0PostgreSQL Development, 24x7 Support, Training & Services


are causing patch v2 to fail for that regr= ession test file.

postgres $ patch -p1 -i ../inet_agg_v2.patch
= patching file src/backend/utils/adt/network.c
patching file src/include/= catalog/pg_aggregate.h
patching file src/include/catalog/pg_proc.h
patching file src/include/ut= ils/builtins.h
patching file src/test/regress/expected/create_function_3= .out
Hunk #1 FAILED at 153.
1 out of 1 hunk FAILED -- saving rejects = to file src/test/regress/expected/create_function_3.out.rej
patching file src/test/regress/expected/inet.out
patching file src/test/= regress/sql/inet.sql

Otherwise it applies without any issues to the = latest HEAD. I built and started a new instance, and I was able to test at = least the basic min/max functionality

keith=3D# create table test_inet (id serial, ipaddress inet);
CREATE= TABLE
Time: 25.546 ms
keith=3D# insert into test_inet (ipaddress) va= lues ('192.168.1.1');
INSERT 0 1
Time: 3.143 ms
keith=3D# = insert into test_inet (ipaddress) values ('192.168.1.2');
INSERT 0 1
Time: 2.932 ms
keith=3D# insert into test_inet (ipaddress)= values ('127.0.0.1');
INSERT 0 1
Time: 1.786 ms
keith=3D#= select min(ipaddress) from test_inet;
=C2=A0=C2=A0=C2=A0 min=C2=A0=C2= =A0=C2=A0
-----------
=C2=A0127.0.0.1
(1 row)

Time: 3.371 ms
keith=3D# select max(ipaddress) from test_= inet;
=C2=A0=C2=A0=C2=A0=C2=A0 max=C2=A0=C2=A0=C2=A0=C2=A0
---------= ----
=C2=A0192.168.1.2
(1 row)

Time: 1.104 ms

--
Keith Fiske
Database Administrator
OmniTI Computer Consulting, Inc.
http://www.keithf4.com
--001a11c2c5a6f90fee04faf3c7de--