This is an automated email from the ASF dual-hosted git repository.
gregfelice pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/age.git
The following commit(s) were added to refs/heads/master by this push:
new ce073ef0 resolve subgraph staging sequences via regclass (#2446)
ce073ef0 is described below
commit ce073ef0c796c7ede90e5c9db24de297564eacce
Author: John Gemignani <[email protected]>
AuthorDate: Mon Jun 29 06:47:55 2026 -0700
resolve subgraph staging sequences via regclass (#2446)
The vertex/edge staging copies in create_subgraph() generated new
graphids with nextval(%L), which binds the sequence as a string literal
and invokes the nextval(text) overload. That re-resolves the
schema-qualified sequence name on each call.
Cast the literal to regclass (nextval(%L::regclass)) so the sequence is
resolved once to its OID, matching how AGE defines its label id defaults
(nextval('schema.seq'::regclass)). Applied to both the vertex and edge
staging queries, in sql/age_subgraph.sql and the identical body in the
age--1.7.0--y.y.y.sql upgrade template so the upgrade-path catalog
comparison still matches.
Behavior is unchanged; all 38 regression tests pass against PostgreSQL 18.
Addresses Copilot review feedback on apache/age#2441.
Co-authored-by: GitHub Copilot (Claude Opus 4.8) <[email protected]>
modified: age--1.7.0--y.y.y.sql
modified: sql/age_subgraph.sql
---
age--1.7.0--y.y.y.sql | 4 ++--
sql/age_subgraph.sql | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/age--1.7.0--y.y.y.sql b/age--1.7.0--y.y.y.sql
index ec909d2b..6dc8f707 100644
--- a/age--1.7.0--y.y.y.sql
+++ b/age--1.7.0--y.y.y.sql
@@ -1013,7 +1013,7 @@ BEGIN
EXECUTE format(
'CREATE TEMP TABLE _ag_sg_vstage ON COMMIT DROP AS '
'SELECT t.id AS old_id, '
- ' ag_catalog._graphid(%s, nextval(%L)) AS new_id, '
+ ' ag_catalog._graphid(%s, nextval(%L::regclass)) AS new_id, '
' t.properties AS props '
'FROM ONLY %s t '
'WHERE EXISTS (SELECT 1 FROM _ag_sg_kept_v k WHERE k.gid = t.id)',
@@ -1076,7 +1076,7 @@ BEGIN
DROP TABLE IF EXISTS _ag_sg_estage;
EXECUTE format(
'CREATE TEMP TABLE _ag_sg_estage ON COMMIT DROP AS '
- 'SELECT ag_catalog._graphid(%s, nextval(%L)) AS new_id, '
+ 'SELECT ag_catalog._graphid(%s, nextval(%L::regclass)) AS new_id, '
' vs.new_id AS new_start, ve.new_id AS new_end, '
' x.properties AS props '
'FROM ONLY %s x '
diff --git a/sql/age_subgraph.sql b/sql/age_subgraph.sql
index 960790de..0d7e3648 100644
--- a/sql/age_subgraph.sql
+++ b/sql/age_subgraph.sql
@@ -205,7 +205,7 @@ BEGIN
EXECUTE format(
'CREATE TEMP TABLE _ag_sg_vstage ON COMMIT DROP AS '
'SELECT t.id AS old_id, '
- ' ag_catalog._graphid(%s, nextval(%L)) AS new_id, '
+ ' ag_catalog._graphid(%s, nextval(%L::regclass)) AS new_id, '
' t.properties AS props '
'FROM ONLY %s t '
'WHERE EXISTS (SELECT 1 FROM _ag_sg_kept_v k WHERE k.gid = t.id)',
@@ -268,7 +268,7 @@ BEGIN
DROP TABLE IF EXISTS _ag_sg_estage;
EXECUTE format(
'CREATE TEMP TABLE _ag_sg_estage ON COMMIT DROP AS '
- 'SELECT ag_catalog._graphid(%s, nextval(%L)) AS new_id, '
+ 'SELECT ag_catalog._graphid(%s, nextval(%L::regclass)) AS new_id, '
' vs.new_id AS new_start, ve.new_id AS new_end, '
' x.properties AS props '
'FROM ONLY %s x '