Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qdiKn-004TVm-UI for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Sep 2023 02:32:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qdiKm-0063tX-Eg for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Sep 2023 02:32:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qdiKm-0063tJ-4M for pgsql-hackers@lists.postgresql.org; Wed, 06 Sep 2023 02:31:59 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qdiKe-002ycD-9f for pgsql-hackers@lists.postgresql.org; Wed, 06 Sep 2023 02:31:58 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3CA4F40003; Wed, 6 Sep 2023 02:31:44 +0000 (UTC) Message-ID: <9d7e468e-12c5-14d0-5950-4fb66bcaeb64@postgresfriends.org> Date: Wed, 6 Sep 2023 04:31:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: information_schema and not-null constraints Content-Language: en-US To: Tom Lane Cc: "David G. Johnston" , Alvaro Herrera , Pg Hackers , Peter Eisentraut , Peter Eisentraut References: <202309051715.7ghhtqh76hyw@alvherre.pgsql> <091fee86-6878-8791-574d-8497e79beb82@postgresfriends.org> <1397251.1693961597@sss.pgh.pa.us> From: Vik Fearing In-Reply-To: <1397251.1693961597@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: vik@postgresfriends.org List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/6/23 02:53, Tom Lane wrote: > Vik Fearing writes: >> On 9/6/23 00:14, David G. Johnston wrote: >>> I'm not all that for either A or B since the status quo seems workable. > >> Pray tell, how is it workable? The view does not identify a specific >> constraint because we don't obey the rules on one side and we do obey >> the rules on the other side. It is completely useless and unworkable. > > What solution do you propose? Starting to enforce the spec's rather > arbitrary requirement that constraint names be unique per-schema is > a complete nonstarter. Changing the set of columns in a spec-defined > view is also a nonstarter, or at least we've always taken it as such. I both semi-agree and semi-disagree that these are nonstarters. One of them has to give. > If you'd like to see some forward progress in this area, maybe you > could lobby the SQL committee to make constraint names unique per-table > not per-schema, and then make the information_schema changes that would > be required to support that. I could easily do that; but now you are asking to denormalize the standard, because the constraints could be from tables, domains, or assertions. I don't think that will go over well, starting with my own opinion. And for this reason, I do not believe that this is a "rather arbitrary requirement". > In general though, the fact that we have any DDL extensions at all > compared to the standard means that there will be Postgres databases > that are not adequately represented by the information_schema views. Sure. > I'm not sure it's worth being more outraged about constraint names > than anything else. Or do you also want us to rip out (for starters) > unique indexes on expressions, or unique partial indexes? Indexes of any kind are not part of the standard so these examples are basically invalid. SQL:2023-11 Schemata is not the part I am most familiar with, but I don't even see where regular multi-column unique constraints are listed out, so that is both a lack in the standard and a knockdown of this argument. I am happy to be shown wrong about this. -- Vik Fearing