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 1wQ8H2-001JI3-15 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2026 18:37:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wQ8Gz-00Apom-0k for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2026 18:37:34 +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 1wQ8Gy-00Apoc-2g for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2026 18:37:33 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wQ8Gx-000000008i6-0Xk9 for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2026 18:37:32 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-48a7fe4f40bso76162915e9.0 for ; Thu, 21 May 2026 11:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779388647; cv=none; d=google.com; s=arc-20240605; b=N2lVbTK5wXO79wP3EuOHJ1dX0bZ01qW7TKl+Hfp5mRKuI5cqbggVnwmMyDERT+j4Ct 5CXb8DSRpVgYbw7RmhozN5poTxL852auKd5r4ohM7v1tLm8MfNnMWZkzQZ8YljiE1M6l FpOpXt7syjQfkHRQggb72Ma8Nj/DzBFDQxa1IGdVdDp/8yVi8qxvAvjbaUnLhElMD6lz 1SnE6WTZE4DX3J8QnjQigUHSfcUIwe3ve4rpYXwRHdrf/+Y9Q3Mhhw2XyhT+t0rGfuMc je47VfMXmz/v5Woj4MDE7dDu8/DmXvGvjdFHp0LlzBinll2LwL7To3Y96ZMv560ZbwPY pFng== 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=BzNKn09Ssc3Fk2e7HhgCXjx1dQu2Oe6v2yjQyQqBScg=; fh=f7oKRHDsTNCRRPpp5lOd0xTTT59jQa1xEy+S4E8oOw4=; b=AUGQa4VW78coBvTQ8sAZMpEZtd7k1/Je046RQU9HgbeWca84c8JZ1FRbMbqvL1Q80Y dM2v2xqvxs9NhC7jwdUzeizQc1+4hZKKjzr8ZGiOAoAtx317eVp6JgRYDbMT0gZ3icwX lqNiexqhZNW2hcIfupa34ePgd3YntTgufRmLAPpvByUFizBGmXHZjOIrwRLaBH/jYth3 zNzbX1Gt1XdNzJ56y5gCcC62/qAHpGonWCTkvXGUhaDN7KDvXsL5syY+lDudacsIXV68 2vzamhW7h4PuAKMSXQuZ4NenyQF+QtzpPfenGOOkrOlxby2AR+eR8ftjd3Ol3DXsGSXe Pscg==; 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=1779388647; x=1779993447; 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=BzNKn09Ssc3Fk2e7HhgCXjx1dQu2Oe6v2yjQyQqBScg=; b=U0I0qpGB5vsVfcVJ41iZp3XNuI2dLWsUYeDJuXg0wsFizh1zkapOqkOwNBlmrIXVoz i5M9hxPaetB8pURDpu519sUEiyOv1SvGIfptXxBzvnVgVz+gD+VshddlJqlPnsI5Y77C vcKnyMAPjy5V6TqwfbaOK2AxVgVL8UwekPO1bKGw1/EcQkVZOKRq7uI8MPETcvfnXX9P FIL4xOayw9aDDNO9+oNc+1U7Ubm7fu/lKcvYgRuG9D53i23eKafOLn4axA9e1RwPOGz8 sqRSNOaGbUU7N3XrvcQ/YBZU+ArHRP4TJzrlEjdKFrsPhERoKxK/0WyvQkD9kUnmJD3O C9QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779388647; x=1779993447; 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=BzNKn09Ssc3Fk2e7HhgCXjx1dQu2Oe6v2yjQyQqBScg=; b=GBOwQd9ECjBovUo4WGiH0AK6emt4Bc4H/qJV+9Fyw6mRKsMWnqMfR3J0GEYhekCSXA n3e1UnmpUg48uNnpdzdzHA5gVzPQgq+CVAQJ3lhsEkVPoo7fiiymBtehE0AGbFdUUiQp nUDwqs2rbJueBy0OkJMpsLgWcpsRkjL6HZrDq/WUhLzsxZ9Bu/qUhAr4hE8bGlsdCvv2 /+psBTEIU4UV++ECEfMDorlAxPrnn+YxGaM7xXi4d8SJdxhMhHTjxWhzfMVxT/GnG67R RFljSd//QVTPJTDgR/fNkHwvmnD+Zdpr980dB5QHynITqFPha5sW1WzSBAQpKLI/OoUw KxFg== X-Forwarded-Encrypted: i=1; AFNElJ+wRKPjU8MQ4Umw87crKf2fO4pAkxhbeMMiYB1cDix1OvOE6BT4WAiDV/aFokVNoZMWTpuIE+5eZS3HrKbM@lists.postgresql.org X-Gm-Message-State: AOJu0YxjkufkhXZ8Wa3bIMYX06roYcIuiV/QVBXcPlvzq3KrgxaMaE3k CGOXYtvxPc/Nuvs/RQhqHn/I88i/dDPNBLRTbOSDm93rHPiBlH1JenHfmwiDAFlfFXLV80kPprd 4ragXK69V6V7/qtoybazBL3tHGlHQsDQ= X-Gm-Gg: Acq92OHVUc2OiURtEMkfUrJUH2cahsJwppqijE6SKZzSRufis+hmEHsERbXfc++pqnw BbSYYVX3Qs3QWzsAl5JfIzqmNzW+7RiEfntT0y+d1mMR96u5Zc78/Bx03yAxmEf15LPZXfN3Plc pkbCqfGqoB4gUWp2fzwrl3kzC4ZrGsgPFEVFqF7GdNJ0MamuvyDMc86jFxp54Pm55/T8H6j28Fv mNL6SuhccE3imueWpFpfLVU9WhFY03n3B9M21ZbQUAoZBrKEN6qn8COHR8J63U+WArgQ7jbeU6J Jzwpi5NBqonXsL9XTeqSGcZmqFDZar5hExmmT0G5TLIssLhvGDs= X-Received: by 2002:a05:600c:4243:b0:48f:d5b2:7c42 with SMTP id 5b1f17b1804b1-4903609db4dmr34133835e9.17.1779388646996; Thu, 21 May 2026 11:37:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Bapat Date: Fri, 22 May 2026 00:07:15 +0530 X-Gm-Features: AVHnY4JZRPp5rR1ELxi1PX7quE16kX6-5nHkTqfhP-XaTiBI1BGaRV9i_euhHU4 Message-ID: Subject: Re: (SQL/PGQ) cache lookup failed for label To: Ayush Tiwari Cc: Junwang Zhao , zengman , pgsql-hackers , Peter Eisentraut 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, May 17, 2026 at 11:26=E2=80=AFPM Ayush Tiwari wrote: > > Hi, > > On Mon, 18 May 2026 at 07:37, Junwang Zhao wrote: >> >> On Mon, May 18, 2026 at 8:22=E2=80=AFAM Ashutosh Bapat >> wrote: >> >> > >> >> > >> I shortened the commit message by taking essential elements from yo= ur >> > >> commit message. >> > >> >> > >> Please review the attached patch. >> > > >> > > >> > > The attached patch seems not for this thread. >> > >> > Thanks for noticing. Here's attached correct patch. >> >> The patch LGTM, thanks for taking care of this. > > > +1, LGTM > > I've changed the status in CF entry status to Ready for Committer. > https://commitfest.postgresql.org/patch/6760/ Thanks Ayush. While working on this, I found two other problems. Before we dive into those, I think we should commit the current patch. It need not wait for a solution to these problems. I was checking whether we should be expanding an empty label during the transformation stage instead of rewrite phase so that, in case the graph pattern is part of a view definition, the set of labels the empty label expression resolves to is stored in the catalogs. That way, we can create a dependency of view on the set of labels at the time of view. After discussing it with Peter Eisentraut, we feel that doing so will be good for future-proofing pg_dump of views containing graph patterns with empty labels. We will definitely need it before supporting all properties reference since the properties that the all properties reference expands to depends upon the set of labels in the label expression. We need to create dependencies between those properties and the view and hence need dependencies between labels (that the empty label expression resolves to) and the view. I will provide a patch for the same soon. When trying different things which could lead to invalidation of view if we don't add the dependency between labels (that the empty label expression resolves to) and the view, I found another way to invalidate the view. To reproduce it, run the following statements after running graph_table.sql tests. CREATE VIEW v_empty_label AS SELECT * FROM GRAPH_TABLE (g1 MATCH (v WHERE v.vprop1 =3D 10) COLUMNS (v.elname)); BEGIN; ALTER PROPERTY GRAPH g1 ALTER VERTEX TABLE v1 DROP LABEL l1; ALTER PROPERTY GRAPH g1 ALTER VERTEX TABLE v2 DROP LABEL l1; ALTER PROPERTY GRAPH g1 ALTER VERTEX TABLE v3 DROP LABEL l1; SELECT * FROM v_empty_label; ROLLBACK; The three ALTER TABLE statements leave the label behind since it's associated with the edge tables. The SELECT statement still throws "ERROR: property "elname" for element variable "v" not found". If we expand the empty label reference in the transformation phase and record dependencies between those labels and the view, we get a different error "ERROR: no property graph element of type "vertex" has label "l1" associated with it in property graph "g1"". The first error is a bit obscure compared to the second one. So there's relative improvement. Myself and Peter thought that the second error is an artifact of the term "vertex labels" in the standard; a term which is not properly defined in the standard. There are two solutions 1. We create vertex label and edge label as separate objects and record depdencies accordingly 2. We ignore the term "vertex/edge label" in the standard and handle labels that exist in property graphs but have no associated element of required type in the query. I think this will require some corrections in standard to standardize the outcome of such queries. I will provide patches once we decide which approach to take. --=20 Best Wishes, Ashutosh Bapat