Skip to content

resolve subgraph staging sequences via regclass#2446

Open
jrgemignani wants to merge 1 commit into
apache:masterfrom
jrgemignani:subgraph_addendum
Open

resolve subgraph staging sequences via regclass#2446
jrgemignani wants to merge 1 commit into
apache:masterfrom
jrgemignani:subgraph_addendum

Conversation

@jrgemignani

Copy link
Copy Markdown
Contributor

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 #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

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#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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the dynamic SQL in ag_catalog.create_subgraph() to call nextval() with a regclass-typed sequence reference, avoiding repeated schema-qualified sequence name resolution during vertex/edge staging while keeping behavior consistent with AGE’s existing sequence default patterns.

Changes:

  • Use nextval(%L::regclass) (instead of nextval(%L)) for vertex staging ID generation.
  • Use nextval(%L::regclass) (instead of nextval(%L)) for edge staging ID generation.
  • Apply the same change to both the canonical SQL and the extension upgrade template to keep upgrade-path objects identical.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
sql/age_subgraph.sql Casts formatted sequence literal to regclass in vertex/edge staging nextval() calls.
age--1.7.0--y.y.y.sql Mirrors the same regclass casting change in the upgrade template for catalog match parity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants