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 1uH3tE-00CnCp-1e for pgsql-hackers@arkaria.postgresql.org; Mon, 19 May 2025 17:03:00 +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 1uH3tC-00HRji-QC for pgsql-hackers@arkaria.postgresql.org; Mon, 19 May 2025 17:02:58 +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 1uH3tC-00HRjR-CY for pgsql-hackers@lists.postgresql.org; Mon, 19 May 2025 17:02:58 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uH3t9-002bps-0R for pgsql-hackers@lists.postgresql.org; Mon, 19 May 2025 17:02:57 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-7424ccbef4eso4756215b3a.2 for ; Mon, 19 May 2025 10:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1747674175; x=1748278975; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=RMiFeVcIu4+7MUJXcYiFgw5OVNrgk5V8dBEFxDOxRDo=; b=2O78A3hNgrt4A5r+dq4vm3VdPyyYRVwKTyequsNlYLI5vh/cNpghn40Bi5WGYyJ6C/ nEoZtgyBbMuE+7rrHC5bstXLkfFBxfQu1xFzqMomtOTBRIzLM9NzpwCCAW5xLArZ8u5e SKvX6BkUoxcvWHBOH2kje3ehTakpcly5CP1DwHlZvxD2koY2AH7MMVN0loDWZz/gQezB +sGcotBZM+dchHb3wH9k//gIpU4FLcWFFcjT5mUjSiFmfbw/lxItgvzo/1ZI+9AWs3rf qMY0qOrFC1VZPIYu517nhr70tpI2n+FwxTUDHtc6+mGVNBsmEdKmhHXuXfxGxJkDT5yL lfqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747674175; x=1748278975; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RMiFeVcIu4+7MUJXcYiFgw5OVNrgk5V8dBEFxDOxRDo=; b=HXFCYwmFpcdPBIYFJhRuffmMwr0Q6B/POQSTeAO/Ie8ajCvBrIm8/KZq/jT3WtKDXg znTg26xnPCiYtYyUkptZyUMuOksDsh65NEvhTQQqzvvMh6DKjALV2QOtlyftxSRw2+nr hUUsWazZo5t78E251u7Z/1VNuSs4sLB6y0n1J860EOqWFS+2Z2ZDqW0NKtID+pA2AqoM AmhjDDLEkSx5gOUAvwqVcllmtTKFJejGSeT6LheS5dnJalPR/tbo65lVXw/v1Uico0DI BiM9RcwHTbDSReavyylbR1ghO57MnRX4EEJE14HExMyaN8WR4cThn3/v1osaoty0jXYC foSg== X-Forwarded-Encrypted: i=1; AJvYcCWQKVoOmfswa/6rL3ztQl5mDI3mac/fhHiYLhRb5CNtRAD+C9ROM1wy0E8m+R8Pp3Pqh2mOqN6Hyt+BiuY/@lists.postgresql.org X-Gm-Message-State: AOJu0YwWQgkfmbOfJq3aJHVir67Zzv1gL3+8fZjzbMno1Rzw711BzCBv jMyaMC/nJo0zKuBL7iw+R5vKBmvhhOjTQHHwZCXHX41msjIQAtgHBDLV26Cz2WmKEQ== X-Gm-Gg: ASbGncsMsaKisM7t9mf8DFgDmcgVSEz0vaU4jI2xXkLVNXZSPHQS7LME5X24hcpQTMa BojaXZYiVtaElfJNz2ybrIJYEpifJH+ndOAXTCcl+8iNv3uXFYRl6z153ZQQHxWAUMKsSOdIN4p gbw7GpC8A/+O+qVJalE7+fxRp7jm8O36CdNwQ2UbeQ3xtIgUpIv6Ha6cmZ7rDM0xgLPlWtF8k7O RiC3I9QfT0FpKh9zAk+Wqo38L5qEMngmlGxaOjnYC3Cjw2oMMZ67wJ6zRrU10ySyYTdNQWl3hwv 3YurGAKL/XlUXcgfvRANb2EYnaBF8k3CkPECV/lB1CMAxTHEwBWRJa+iwQPb3gB8Syof000mxwg BR4+1cE+fI4v/rfi7GVPxqA== X-Google-Smtp-Source: AGHT+IHyfusN4ThjMqIYWuJ6N8fFoPhzvgulFpdCiLhBmxahrAQyVF3IVynPYKwLcZaGH65zVBoaBA== X-Received: by 2002:a05:6a21:3289:b0:1f5:8220:7452 with SMTP id adf61e73a8af0-216219356ddmr20085503637.24.1747674174787; Mon, 19 May 2025 10:02:54 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b26eb0a0120sm6528434a12.63.2025.05.19.10.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 10:02:53 -0700 (PDT) Message-ID: Subject: Re: Avoid orphaned objects dependencies, take 3 From: Jeff Davis To: Robert Haas , Bertrand Drouvot Cc: Michael Paquier , Alexander Lakhin , pgsql-hackers@lists.postgresql.org, Tom Lane Date: Mon, 19 May 2025 10:02:52 -0700 In-Reply-To: References: <62310067-6dc4-97ab-6724-7d3602b5056d@gmail.com> <403075e1-4d60-09e2-a06a-749cd9d88f66@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2024-05-22 at 10:48 -0400, Robert Haas wrote: > > Then, Tom proposed another approach in [2] which is that "creation > > DDL will have > > to take a lock on each referenced object that'd conflict with a > > lock taken by DROP". > > This is the one the current patch is trying to implement. >=20 > It's a clever idea, but I'm not sure that I like it. I'm not sure if you intended it this way, but using "clever" here suggests that it's an unusual trick. But isn't that the kind of thing heavyweight locks are for? >=20 > My concern was really more about the maintainability of > the code. I fear that if we add code that takes heavyweight locks in > surprising places, we might later find the behavior difficult to > reason about. FWIW, a lock while recording a dependency would not be surprising to me. Assuming that heavyweight locks are the right approach, the locks need to be taken somewhere. And expecting all the callers to get it right seems error-prone. This is a long thread so I must be missing some problem or complication here. Regards, Jeff Davis