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.96) (envelope-from ) id 1wX4F8-0032Bl-0h for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jun 2026 21:44:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wX4F6-008SWs-38 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jun 2026 21:44:16 +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.96) (envelope-from ) id 1wX4F6-008SSt-1V for pgsql-hackers@lists.postgresql.org; Tue, 09 Jun 2026 21:44:16 +0000 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wX4F4-00000001uYm-0D61 for pgsql-hackers@lists.postgresql.org; Tue, 09 Jun 2026 21:44:15 +0000 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-4864a5c83f1so3862046b6e.0 for ; Tue, 09 Jun 2026 14:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20251104.gappssmtp.com; s=20251104; t=1781041452; x=1781646252; 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=vHFPkDBx6k2ZDOI/PEHJzDjuJf/nPCIvH7kN2hecKLw=; b=pQNRaBYaAY1qOpJlwUr3SAo8aP2JsMnHUby+hBLFosi7wSpuGmJ3irTdZFYMF7NPrF 53dJhkFH8hkG5wAWgsnPstUvjVp1LHfLV/yZ0SF5hdzC8hNW5TgSbH29gUxcUW2sJ6UC 24E2y6iVfto/hublZTa+TJqo8UMMPHuIYX50jrqR4kQ74XtPLBmqmp6nZDYFNUGl7XF1 uDYgGFUBHCWwHx2aeeaM4UbZ8oqZpYk4VpdgJI0znz2EZ7MngeeIZvK1+V0dtm6Tss/i Up3+F7fx4ArAaD1FKTgy2R431ZcwFMi5DtY19m9kaufwVTlwd8TLLyibgg5KU66mP1dq 4yHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781041452; x=1781646252; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vHFPkDBx6k2ZDOI/PEHJzDjuJf/nPCIvH7kN2hecKLw=; b=Io81iJfW+psuVYVeGls81ngiErwrWrIr+yg5i1RBHnnOBs2b29bL2FhiPr64L/exfL o5m4Q5SL5XDY0vmwbEIArPEBUWTXYPSjq62OoV/jJZ1oj5arEUZ2crBj21Jrd+OZGC5N LyK9o7ia1pLKEpFJuhkYkMHpBKCNSEIeNgsFwNO8xdMAvXqyLyhqYRC/h3G88SQSQCG8 4XL+EgWp4XDAvHXwASKI76YmfXTkGHersMw6TOP4CIoh+HI0zihXkv6svzYkaVperEpw CXyECVZQ04IPjHja4e6vTRusBysCSeYn3avRw25Y2Sn35/vD5TFjbWwAVXk/QRe8kZwF LwCg== X-Forwarded-Encrypted: i=1; AFNElJ9AXhcmR4FfF1He07mZD9PEhd3/TEptVTuBIhJQ7G4ftCm0gTpjl+iWhWpSY/xszguBrL3bcxaWpYUytDHH@lists.postgresql.org X-Gm-Message-State: AOJu0Yym+TZt+iXN//uDwryTzjAin9MO2cPMR3ehnvKproCOGYnb3hDY OgIwiaaX+8YKNkJtSCLbTVi4lhQCPPE4fMKk2XxaitwmE4tPQ/TTrvwAe8IzW8DE7TPDKu4sfh4 DBv0= X-Gm-Gg: Acq92OFr5F2I4kZC8KgGi6xP5VSZiJtUNrZ5jN9qPfgU0BlMt7ae4rw3Rqd4QoD1HjS jIrlU7E85eMqYR7EpjLqu+YbJUawqrl0Tu7QlkjwcBiWrbu06aKOKz6o8JqKvoXsWhKKuVPJBku 6mbXM9kFa2H1g9Zl4WfFOo6BHlkCXYuz/raHpB8d1lRyDKmV9XFBkPBbeePRrc09DddHZV/JpPH zicnwoPaCpGTUDI05MhGh6asL/uohThn3UCdr1HJXZQqOK3zTJTXVGvJLoeduLRKqmX7qTpF+9G GTGZ5b3fqnSSNxbhRL6D553TQD3XHB5uZm1ncnUNR6CuRySxypCv11/h7LxQor99Lb9OOBQzl3L pJlTrl3hxjyEXdyqSSRlFC2QwJpSqug7LR+920eWKPMRmrcloQvuYOlI1Z2YmGHU8Tqtfnjya8x Kie5loNkWejDvWYOpmk3p1P1oILKo7QEsuxA== X-Received: by 2002:a05:6808:30aa:b0:485:1618:a84a with SMTP id 5614622812f47-4868df27dcdmr13952884b6e.37.1781041452444; Tue, 09 Jun 2026 14:44:12 -0700 (PDT) Received: from [10.10.245.117] ([50.175.226.11]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e6e75c5495sm14994117a34.10.2026.06.09.14.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 14:44:11 -0700 (PDT) Message-ID: <0fc145b9b5cf3f59207cf4ca60270448a2891c46.camel@j-davis.com> Subject: Re: Avoid orphaned objects dependencies, take 3 From: Jeff Davis To: Bertrand Drouvot Cc: Heikki Linnakangas , Robert Haas , Roman Eskin , Michael Paquier , Alexander Lakhin , pgsql-hackers@lists.postgresql.org, Tom Lane Date: Tue, 09 Jun 2026 14:44:10 -0700 In-Reply-To: References: <3963e573-4852-4d25-b741-7c5c7e1f9140@iki.fi> <02e28438bd448ff4ee8f6fd78e6b74e657172d73.camel@j-davis.com> <71eb9a8835a28165939da567a9d649fe6d21bfa7.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1.1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Tue, 2026-06-09 at 06:47 +0000, Bertrand Drouvot wrote: > In order to be on the safe side of things, the attached now iterates > through all > matching entries (and not only the last one). I don't think: if (context =3D=3D PROCESS_UTILITY_TOPLEVEL) is quite right. With SPI, I bet you can end up in a situation where the branch fires twice (causing an early reset) or not at all (because the only call is PROCESS_UTLITY_QUERY). In any case, I don't think mixing the tracking entries between entirely different DDL commands is a good idea. If you execute DDL inside of SPI in its own subtransaction, and it inserts a tracking entry to recheck something, and then you roll back the subxact, you don't want the tracking entry to then cause the outer transaction to fail. I didn't test this, so if there's something preventing this kind of problem, let me know. We probably need to track where we are in the stack of ProcessUtility() calls and keep the tracking entries separate, and always remove entries from that level on return (or rollback). Regards, Jeff Davis