Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9wyA-0000sf-MB for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Nov 2017 17:38:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e9wyA-0002ff-7n for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Nov 2017 17:38:26 +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 1e9wwc-0008FU-D9 for pgsql-hackers@postgresql.org; Wed, 01 Nov 2017 17:36:50 +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.84_2) (envelope-from ) id 1e9wwZ-0007m9-Ri for pgsql-hackers@postgresql.org; Wed, 01 Nov 2017 17:36:49 +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 vA1HaklC009889; Wed, 1 Nov 2017 13:36:46 -0400 From: Tom Lane To: Michael Paquier cc: PostgreSQL mailing lists Subject: Re: ALTER COLUMN TYPE vs. domain constraints In-reply-to: References: <30656.1509128130@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Sat, 28 Oct 2017 14:07:59 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9887.1509557806.1@sss.pgh.pa.us> Date: Wed, 01 Nov 2017 13:36:46 -0400 Message-ID: <9888.1509557806@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Michael Paquier writes: > On Fri, Oct 27, 2017 at 11:15 AM, Tom Lane wrote: >> We could consider back-patching the attached to cover this, but >> I'm not entirely sure it's worth the trouble, because I haven't >> thought of any non-silly use-cases in the absence of domains >> over composite. Comments? > There are no real complaints about the current behavior, aren't there? > So only patching HEAD seems enough to me. Yeah, we can leave it till someone does complain. > You have added a comment on the constraint to make sure that it > remains up on basically this ALTER TYPE. Querying pg_obj_description > would make sure that the comment on the constraint is still here. Done. > +RebuildDomainConstraintComment(AlteredTableInfo *tab, int pass, Oid objid, > + List *domname, char *conname) > There is much duplication with RebuildConstraintComment. Why not > grouping both under say RebuildObjectComment()? True. I'd originally expected the code to differ more, but we can merge these easily enough. > I would think about > having cmd->objtype and cmd->object passed as arguments, and then > remove rel and domname from the existing arguments. Doing it like that requires the callers to do work (to prepare the object ID data structure) that's wasted if there's no comment, which most often there wouldn't be, I suspect. Seems better to just pass the info the caller does have and let this function do the rest. Pushed, thanks for reviewing! regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers