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 1wHjy3-007TLZ-26 for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Apr 2026 15:03:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wHjx3-000Ekt-1l for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Apr 2026 15:02:17 +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 1wHjx3-000Eji-08 for pgsql-hackers@lists.postgresql.org; Tue, 28 Apr 2026 15:02:17 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wHjww-00000003Cju-2yUd for pgsql-hackers@lists.postgresql.org; Tue, 28 Apr 2026 15:02:15 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4838c15e3cbso107155515e9.3 for ; Tue, 28 Apr 2026 08:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1777388528; cv=none; d=google.com; s=arc-20240605; b=bQF1yvwE0cdHUGagO1zepGj4jEdwORZFvXOI+3X4HjhB64XbT0DC66PFePPfO26KVy IemDKvVya7qrcrIhinwUTUegVydyts0y1t/D6Cv0y6lm2WdtdZqVizjVYTgs8GL9ckhn qpdlJ7swuhgU4TFJwLH9RdzC8TgpHArt7aJq2XlVfa9OT39RG71KTIUptzD84ltgSibJ VO8MXgsk9OeB9Roqb2VLhZ9UVDNKMQrJYhwfBjLMRhGGB9UyCOmR427iCGIQAo+cS5fK CAxsiQWyMwxaxh90zDMn4Gud63vA5UuANJPxwA3+mh7QG7mUuZTcB+60LaclGIORxc0R JuZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+vkoYEqLgy0qF6fVwGa+OUwArkgWCpDpfXEUUZ2qjxI=; fh=difWPyZhf+FMfWnUHiBJsrLSKQJL23D1+3HP+YAZNos=; b=HelFnkwVgjKVWtmkQsoC9IkRLEdoomAH6hQExwGAJOsEWjFMN11IZb27HffJSOjjAV 3+/sOUT/CvqVRLBBnnoVgvI+iybhvo8K3kOBG1bhVejZ5fAR9vWDnTbcYkzJpkSDTrAm WaadSrJOv6KGyxU0m/H7jr8xJMx382ojkdt7uhz+JCYkv0SML31MejODlQnuXUuinIp5 K9LkYxIz4KtmA7OdGMs2nUN9dnsK2DqlIM0uRg9BE/GWTtizlS2vmxMxyoyKhXVZgYlr 5mh4w7ZUcstBKxjj0pGoWgqoivNdJ5ScmY0vWN+wrBQ/dVLt+RGf5Zbv2AzUiqEEcVJI ruaQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777388528; x=1777993328; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+vkoYEqLgy0qF6fVwGa+OUwArkgWCpDpfXEUUZ2qjxI=; b=cIY0CptNzfWr6xH3VrMdQHnjzotWhkzCHShhoSxxAs6V4XmmCc+01SDS5+Iup9R1ie c5YJNvB6Mk+dVjK5xeBDukoIHpyPxI5eV/5J3IFpgsewK/mxE0pDDnksIT4nXUJglVpn aODe+alKLZKfx9uQw7EE99LVv5cuCQf4ZzW4EY8184UpnoVTtJk0vort6BIsZKapSI+e S4HvL8g2ZDg0bRIF2dZd7KBukb8JTDUsysNQZ5D6sh9Mgc06XAauEff6JGQ8KTnh7UFh k03OfsA8VfN8vKbiZdBKY5E0H83lR/SB1Xt1S1m8LhyqgRI3UecNOXRJ7h1cDHw+2Q5p Pukw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777388528; x=1777993328; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+vkoYEqLgy0qF6fVwGa+OUwArkgWCpDpfXEUUZ2qjxI=; b=gfdAPHIici+SrOGyOWOETlQgcbSwxhD2vpfQbBF6vgpjvgMX70Wse1KxazMHL7RtrY LU8GvCUZ3vntML2xG3poOknqxr2ABCaC4iSk4uN0Bhm8Q5SKkury/txIbcoqp9lAUQrs UcC4GXM0ntCTuC0rtQikIFVXR9uQbKfq4fhbD2V4/uRUV7Fj7vugqEWWRUTnMoVKC+Kd 6fn7eFjWiKHFocGY3FhqrBZc1W8Md2ATMlp1UAk4oY7PI3v9No0z0krki6OhqZwaT/bM c1Ae+twfesEmQBbGL/N1e2R0sfSPGmZz50LUyll4BhiXccoSMSfl7qjaVPZepBYqclMM j2Lg== X-Gm-Message-State: AOJu0YyPRCHJwnzVdJ8/S/sD2c/KgwXRURRveGVxpF4ronVJE46JAtgV ZcuaQ7pb+T2+pYqWJHeCHqT94MX+AXZSc9fyLbsF5kM15KuDnYvT8Kt4Aqc8WCk2gCmCephprCK B3MX148FayNBXwt8yebnl0uOAFkDES8nJ05Rq X-Gm-Gg: AeBDietEmW8oXR4BN+Sfh+AamAaJUyS8uyTAv8z1PrsRxWZF5JlcaEN3Vc6j7tPMKDJ JgncBQTvzZOR/zBS+BeuDirDuTgoQ0ONAfcq1G4AkLTVQey64AOkOKKFMM4GtL4+8M0WRjeB6RT mtxS9qLhEI2hOjkDq1rJdiGyOb1Hhz2wZHCyiXSJSt9fybJiA7bGCybd4OC6QchK0uLV+njmmU1 B2/D8Sr63SQln4+9hnsMDQFx73w4FwHGVMCWnV2Olj0TH0WPS6kMTPYwWYP81WktzOKn2Vm1C3z qUO/CHFV9wg9plQUDjEvA4Bej9hp/VYSitgG3Z4JIsXRl/xwvA2/P+PLD3SNgw== X-Received: by 2002:a05:600c:8217:b0:487:219e:42d with SMTP id 5b1f17b1804b1-48a7ad9cf53mr12544525e9.11.1777388527648; Tue, 28 Apr 2026 08:02:07 -0700 (PDT) MIME-Version: 1.0 References: <1DA5D52A-4AFA-426E-83F7-42ED974D682B@gmail.com> In-Reply-To: From: Ashutosh Bapat Date: Tue, 28 Apr 2026 20:31:56 +0530 X-Gm-Features: AVHnY4JtG6vgxwb-CHk4uBpYTUVqDbO-sfxkxEGDtQ82SutNkNv-j3uzdQQcfdY Message-ID: Subject: Re: Property graph: fix error handling when dropping non-existent label property To: Chao Li Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Apr 26, 2026 at 12:51=E2=80=AFPM Chao Li w= rote: > > > > > On Apr 24, 2026, at 20:38, Ashutosh Bapat wrote: > > > > On Fri, Apr 24, 2026 at 1:03=E2=80=AFPM Chao Li wrote: > >> > >> Hi, > >> > >> I am testing graph tables today and noticed an improper error message = when dropping a property. > >> > >> Here is a simple repro: > >> ``` > >> evantest=3D# CREATE TABLE t1 (a int PRIMARY KEY, b int); > >> CREATE TABLE > >> evantest=3D# > >> evantest=3D# CREATE PROPERTY GRAPH g > >> evantest-# VERTEX TABLES ( > >> evantest(# t1 > >> evantest(# LABEL l1 PROPERTIES (a AS p1) > >> evantest(# LABEL l2 PROPERTIES (b AS p2) > >> evantest(# ); > >> CREATE PROPERTY GRAPH > >> evantest=3D# > >> evantest=3D# ALTER PROPERTY GRAPH g > >> evantest-# ALTER VERTEX TABLE t1 > >> evantest-# ALTER LABEL l1 DROP PROPERTIES (p2); > >> ERROR: could not find tuple for label property 0 > >> ``` > >> > >> This does not look like a normal user-facing SQL error message. > >> > >> Looking into the code, AlterPropGraph() checks whether the property ex= ists in the graph, but does not check if label property exists. As a result= , InvalidOid can be passed to ObjectAddressSet() and then to performDeletio= n(). > >> > >> The fix is simple, just check the label-property OID before trying to = delete it. I also added a regress test. > >> > >> With the patch, the error becomes: > >> ``` > >> evantest=3D# ALTER PROPERTY GRAPH g > >> evantest-# ALTER VERTEX TABLE t1 > >> evantest-# ALTER LABEL l1 DROP PROPERTIES (p2); > >> ERROR: property graph "g" element "t1" label "l1" has no property "p2= " > >> ``` > > > > Thanks for the report. Agree that we need to provide a correct error > > message. The code changes look good to me. > > Cool! Thanks for reviewing and confirming. > > > However, the way you have > > written this code is different from similar code earlier in the > > function. Either your code should match that style or that code should > > be changed to your style. I like your way - reduces code a bit and > > does not repeat ereport. I also noticed that the code to fetch the > > element label oid from element_alias and label name is repeated along > > with the ereport in a few places. I think we could instead write a > > function to do that and call that function in those places. When > > writing the function, we could change that code to use your style. > > I updated the nearby code to align with my style. PFA v2. Looks good to me. However, I did change OidIsValid() and !OidIsValid() back to (oid) and (!oid) conditions to be consistent with the rest of the code. I tried to deduplicate the code which finds element labelid from given element alias and label name. But there is one place where we also use the label oid and or the element oid that the code extracts. So it didn't end up being a lot of improvement. Since this patch conflicts with the patch at [1], I am posting this patch along with the patch there on that thread so that both can be committed without causing a merge conflict. If necessary we can continue discussion here. [1] https://www.postgresql.org/message-id/CAExHW5uThebnwqyWHrsF2Z+no-fT8VrM= 0Yj+RU7YWrYzdavUZg@mail.gmail.com --=20 Best Wishes, Ashutosh Bapat