Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZiPY-00079J-TD for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2018 19:21:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZiPX-00015V-QP for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2018 19:21:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eZiPX-00015L-GV for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2018 19:21:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eZiPQ-0003R7-Gg for pgsql-hackers@postgresql.org; Thu, 11 Jan 2018 19:21:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0BJKqst012568; Thu, 11 Jan 2018 14:20:52 -0500 From: Tom Lane To: Robert Haas cc: Andres Freund , Dmitry Dolgov <9erthalion6@gmail.com>, Michael Paquier , Arthur Zakirov , Oleg Bartunov , Peter Eisentraut , David Steele , PostgreSQL-development Subject: Re: [HACKERS] [PATCH] Generic type subscripting In-reply-to: References: <20171116114016.GA21162@zakirov.localdomain> <20171119151350.GA23853@arthur.localdomain> <8809.1515031526@sss.pgh.pa.us> <20180108232959.s2ipp7tjcvlaixcs@alap3.anarazel.de> <846.1515629363@sss.pgh.pa.us> <10021.1515694533@sss.pgh.pa.us> <10983.1515695825@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Thu, 11 Jan 2018 14:05:15 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12566.1515698452.1@sss.pgh.pa.us> Date: Thu, 11 Jan 2018 14:20:52 -0500 Message-ID: <12567.1515698452@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Thu, Jan 11, 2018 at 1:37 PM, Tom Lane wrote: >> Right, but in the case of stored arrays, we've decided that it *is* >> our problem (as indeed it must be, because the user has no tools with >> which they could fix a representation change for stored data). The >> question is to what extent that need would propagate to pseudo array >> types. > I think I view the rationale a bit differently. Let's say that a user > defines a composite type as (a int, b text) and uses that composite > type as a column type. Then, somebody tries to change column a to > have type text, and suppose we don't throw an error but simply permit > the operation. If the user now tries to select from the offending > column, the server will very likely crash. In contrast, in the case > where the user has defined an SQL function that selects $1.a and > returns it as an int, they will get a runtime error when they try to > use the function. In my mind, that is the critical difference. There are two critical differences --- that's one, and the other is that there are SQL-level ways to fix the problem, ie change the function text with CREATE OR REPLACE FUNCTION. We don't have a SQL command that says "now go update the representation of table T column C". But I think we've probably beaten this topic to death ... regards, tom lane