You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jg...@apache.org on 2026/09/18 16:12:33 UTC

(age) 01/01: Revert "Update PG15 to Apache AGE 1.8.0 (#2572)"

This is an automated email from the ASF dual-hosted git repository.

jrgemignani pushed a commit to branch revert-2572-PG15_1.8.0
in repository https://gitbox.apache.org/repos/asf/age.git

commit af539a1be00ecbcb82f84cf1c99ef77594a1cabc
Author: John Gemignani <jr...@gmail.com>
AuthorDate: Fri Sep 18 09:12:26 2026 -0700

    Revert "Update PG15 to Apache AGE 1.8.0 (#2572)"
    
    This reverts commit 62280c290222ffa9c0a9e5f633c90174ece39bc3.
---
 .github/labeler.yml                                |   17 +
 .github/workflows/installcheck.yaml                |   34 +-
 .github/workflows/labeler.yml                      |   30 +
 .github/workflows/nodejs-driver.yaml               |    4 +-
 .github/workflows/python-driver.yaml               |    9 +-
 .gitignore                                         |    4 -
 META.json                                          |   10 +-
 Makefile                                           |  314 +--
 README.md                                          |  114 +-
 RELEASE                                            |  206 +-
 age--1.6.0--1.8.0.sql                              | 1238 -----------
 age--1.8.0--y.y.y.sql => age--1.6.0--y.y.y.sql     |    4 +-
 age.control                                        |    2 +-
 docker/Dockerfile                                  |    2 +-
 drivers/golang/go.mod                              |    2 +-
 drivers/golang/go.sum                              |   10 +-
 drivers/jdbc/lib/build.gradle.kts                  |    6 +-
 .../org/apache/age/jdbc/BaseDockerizedTest.java    |   19 +-
 drivers/nodejs/package.json                        |   11 +-
 drivers/nodejs/src/antlr4/CustomAgTypeListener.ts  |    6 +-
 drivers/nodejs/src/index.ts                        |  301 +--
 drivers/nodejs/test/Agtype.test.ts                 |   27 -
 drivers/nodejs/test/index.test.ts                  |  285 +--
 drivers/python/README.md                           |   33 +-
 drivers/python/age/VERSION.py                      |   44 +-
 drivers/python/age/__init__.py                     |   81 +-
 drivers/python/age/age.py                          |  692 ++----
 drivers/python/age/builder.py                      |  462 ++--
 drivers/python/age/exceptions.py                   |   59 +-
 drivers/python/age/gen/AgtypeLexer.py              |    7 +-
 drivers/python/age/gen/AgtypeListener.py           |    7 +-
 drivers/python/age/gen/AgtypeParser.py             |    7 +-
 drivers/python/age/gen/AgtypeVisitor.py            |    7 +-
 drivers/python/age/models.py                       |  626 +++---
 drivers/python/age/networkx/lib.py                 |   97 +-
 drivers/python/pyproject.toml                      |   53 -
 drivers/python/requirements.txt                    |  Bin 64 -> 174 bytes
 drivers/python/setup.py                            |   62 +-
 drivers/python/test_age_py.py                      |  380 +---
 drivers/python/test_agtypes.py                     |  454 ++--
 drivers/python/test_networkx.py                    |    2 +-
 drivers/python/test_security.py                    |  274 ---
 regress/age_load/data/bad_delim_edges.csv          |    2 -
 regress/age_load/data/edges_long_row.csv           |    2 -
 regress/age_load/data/edges_short_row.csv          |    2 -
 regress/age_load/data/labels_long_row.csv          |    2 -
 regress/expected/age_global_graph.out              |  366 +--
 regress/expected/age_load.out                      |  304 +--
 regress/expected/age_reduce.out                    |  850 -------
 regress/expected/age_shortest_path.out             | 1729 ---------------
 regress/expected/age_upgrade.out                   |  579 -----
 regress/expected/agehash.out                       |   14 -
 regress/expected/agtype.out                        |  241 +-
 regress/expected/agtype_jsonb_cast.out             |  261 ---
 regress/expected/catalog.out                       |  141 +-
 regress/expected/containment_selectivity.out       |  245 --
 regress/expected/cypher.out                        |   16 -
 regress/expected/cypher_call.out                   |   54 -
 regress/expected/cypher_match.out                  |  573 +----
 regress/expected/cypher_merge.out                  |  554 +----
 regress/expected/cypher_set.out                    |  266 ---
 regress/expected/cypher_subquery.out               |  169 +-
 regress/expected/cypher_union.out                  |    1 -
 regress/expected/cypher_vle.out                    |  366 +--
 regress/expected/cypher_with.out                   |  341 +--
 regress/expected/direct_field_access.out           |  535 -----
 regress/expected/drop.out                          |   12 +-
 regress/expected/expr.out                          | 1637 +-------------
 regress/expected/extension_security.out            |   99 -
 regress/expected/generated_columns.out             |  222 --
 regress/expected/graph_generation.out              |   20 +-
 regress/expected/index.out                         |  421 +---
 regress/expected/list_comprehension.out            |  127 +-
 regress/expected/map_projection.out                |    2 +-
 regress/expected/pattern_expression.out            |  513 -----
 regress/expected/pgvector.out                      |    4 +-
 regress/expected/predicate_functions.out           |  641 ------
 regress/expected/reserved_keyword_alias.out        |  248 ---
 regress/expected/scan.out                          |   47 -
 regress/expected/security.out                      | 1657 --------------
 regress/expected/subgraph.out                      |  341 ---
 regress/sql/age_global_graph.sql                   |  238 +-
 regress/sql/age_load.sql                           |  198 +-
 regress/sql/age_reduce.sql                         |  548 -----
 regress/sql/age_shortest_path.sql                  | 1113 ----------
 regress/sql/age_upgrade.sql                        |  546 -----
 regress/sql/agehash.sql                            |    9 -
 regress/sql/agtype.sql                             |  147 +-
 regress/sql/agtype_jsonb_cast.sql                  |  137 --
 regress/sql/catalog.sql                            |   42 +-
 regress/sql/containment_selectivity.sql            |  156 --
 regress/sql/cypher.sql                             |    7 -
 regress/sql/cypher_call.sql                        |   25 -
 regress/sql/cypher_match.sql                       |  259 +--
 regress/sql/cypher_merge.sql                       |  299 ---
 regress/sql/cypher_set.sql                         |  164 --
 regress/sql/cypher_subquery.sql                    |   17 +-
 regress/sql/cypher_vle.sql                         |  202 +-
 regress/sql/cypher_with.sql                        |  156 +-
 regress/sql/direct_field_access.sql                |  319 ---
 regress/sql/drop.sql                               |    9 -
 regress/sql/expr.sql                               |  546 +----
 regress/sql/extension_security.sql                 |   82 -
 regress/sql/generated_columns.sql                  |  129 --
 regress/sql/index.sql                              |  222 +-
 regress/sql/list_comprehension.sql                 |   28 -
 regress/sql/pattern_expression.sql                 |  342 ---
 regress/sql/pgvector.sql                           |    4 +-
 regress/sql/predicate_functions.sql                |  383 ----
 regress/sql/reserved_keyword_alias.sql             |  102 -
 regress/sql/scan.sql                               |   21 -
 regress/sql/security.sql                           | 1451 ------------
 regress/sql/subgraph.sql                           |  189 --
 sql/age_aggregate.sql                              |   26 -
 sql/age_main.sql                                   |   55 +-
 sql/age_pg_upgrade.sql                             |  487 ----
 sql/age_scalar.sql                                 |    9 -
 sql/age_subgraph.sql                               |  294 ---
 sql/agtype_coercions.sql                           |   27 -
 sql/agtype_exists.sql                              |   24 +-
 sql/agtype_graphid.sql                             |  201 +-
 sql/agtype_operators.sql                           |   16 +-
 sql/agtype_typecast.sql                            |   62 +-
 sql/sql_files                                      |    2 -
 src/backend/age.c                                  |   44 -
 src/backend/catalog/ag_catalog.c                   |  222 +-
 src/backend/catalog/ag_label.c                     |  157 +-
 src/backend/commands/label_commands.c              |  138 +-
 src/backend/executor/cypher_create.c               |   25 +-
 src/backend/executor/cypher_delete.c               |  430 +---
 src/backend/executor/cypher_merge.c                |  354 +--
 src/backend/executor/cypher_set.c                  |  366 +--
 src/backend/executor/cypher_utils.c                |  923 +-------
 src/backend/nodes/ag_nodes.c                       |    8 +-
 src/backend/nodes/cypher_copyfuncs.c               |   28 -
 src/backend/nodes/cypher_outfuncs.c                |   40 +-
 src/backend/nodes/cypher_readfuncs.c               |   57 +-
 src/backend/optimizer/cypher_paths.c               |    8 -
 src/backend/parser/ag_scanner.l                    |   10 -
 src/backend/parser/cypher_analyze.c                |   68 +-
 src/backend/parser/cypher_clause.c                 | 2336 ++------------------
 src/backend/parser/cypher_expr.c                   |  465 +---
 src/backend/parser/cypher_gram.y                   |  913 +++-----
 src/backend/parser/cypher_parse_agg.c              |   33 +-
 src/backend/parser/cypher_transform_entity.c       |    1 -
 src/backend/utils/adt/age_global_graph.c           | 1069 +++------
 src/backend/utils/adt/age_graphid_ds.c             |   91 -
 src/backend/utils/adt/age_vle.c                    | 2157 ++++--------------
 src/backend/utils/adt/agtype.c                     | 1442 ++----------
 src/backend/utils/adt/agtype_ext.c                 |   29 +-
 src/backend/utils/adt/agtype_ops.c                 |   46 +-
 src/backend/utils/adt/agtype_raw.c                 |   28 +-
 src/backend/utils/adt/agtype_util.c                |  497 +----
 src/backend/utils/cache/ag_cache.c                 |  174 +-
 src/backend/utils/cache/agehash.c                  |  756 -------
 src/backend/utils/load/ag_load_edges.c             |  489 ++--
 src/backend/utils/load/ag_load_labels.c            |  586 +++--
 src/backend/utils/load/age_load.c                  |  475 +---
 src/backend/utils/load/libcsv.c                    |  549 +++++
 src/include/catalog/ag_catalog.h                   |    2 -
 src/include/catalog/ag_label.h                     |    2 +-
 src/include/executor/cypher_utils.h                |   38 -
 src/include/nodes/ag_nodes.h                       |    9 +-
 src/include/nodes/cypher_copyfuncs.h               |    8 -
 src/include/nodes/cypher_nodes.h                   |   47 -
 src/include/nodes/cypher_outfuncs.h                |    2 -
 src/include/nodes/cypher_readfuncs.h               |    6 -
 src/include/optimizer/cypher_createplan.h          |    7 -
 src/include/optimizer/cypher_pathnode.h            |    7 -
 src/include/parser/cypher_clause.h                 |    9 -
 src/include/parser/cypher_expr.h                   |    5 -
 src/include/parser/cypher_kwlist.h                 |    5 -
 src/include/parser/cypher_transform_entity.h       |   11 -
 src/include/utils/age_global_graph.h               |   61 +-
 src/include/utils/age_graphid_ds.h                 |   25 -
 src/include/utils/agehash.h                        |  216 --
 src/include/utils/agtype.h                         |  171 --
 src/include/utils/load/ag_load_edges.h             |   52 +-
 src/include/utils/load/ag_load_labels.h            |   55 +-
 src/include/utils/load/age_load.h                  |   41 +-
 src/include/utils/load/csv.h                       |  108 +
 tools/gen_keywordlist.pl                           |    1 -
 182 files changed, 5254 insertions(+), 39547 deletions(-)

diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 00000000..92ab6db8
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,17 @@
+PG11:
+- base-branch: 'PG11'
+
+PG12:
+- base-branch: 'PG12'
+
+PG13:
+- base-branch: 'PG13'
+
+PG14:
+- base-branch: 'PG14'
+
+PG15:
+- base-branch: 'PG15'
+
+master:
+- base-branch: 'master'
\ No newline at end of file
diff --git a/.github/workflows/installcheck.yaml b/.github/workflows/installcheck.yaml
index 37d2df0b..51bfd2a4 100644
--- a/.github/workflows/installcheck.yaml
+++ b/.github/workflows/installcheck.yaml
@@ -8,12 +8,7 @@ on:
 
 jobs:
   build:
-    # Pinned (not ubuntu-latest) so the Bison version stays fixed at 3.8.x.
-    # The Cypher GLR grammar pins exact conflict counts via %expect / %expect-rr
-    # in src/backend/parser/cypher_gram.y, and Bison treats %expect as exact-match:
-    # a different Bison version can report different counts and break the build.
-    # Freezing the runner image freezes Bison; bump both together, intentionally.
-    runs-on: ubuntu-24.04
+    runs-on: ubuntu-latest
 
     steps:
       - name: Get latest commit id of PostgreSQL 15
@@ -32,27 +27,6 @@ jobs:
           sudo apt-get update
           sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison
 
-      - name: Verify Bison version (grammar conflict counts are pinned)
-        run: |
-          ver=$(bison --version | awk 'NR==1 {print $NF}')
-          if [ -z "$ver" ]; then
-            echo "::error::Could not determine Bison version from 'bison --version'."
-            echo "::error::Expected the first line to end with a version (e.g. '... 3.8.2')."
-            exit 1
-          fi
-          echo "bison $ver"
-          case "$ver" in
-            3.8.*) ;;
-            *)
-              echo "::error::Bison $ver != 3.8.x. The Cypher GLR grammar pins exact"
-              echo "::error::%expect / %expect-rr conflict counts in src/backend/parser/cypher_gram.y."
-              echo "::error::A new Bison version may report different counts. Re-run bison locally,"
-              echo "::error::update the %expect/%expect-rr numbers (and the comment block), then bump"
-              echo "::error::the pinned runner image and this guard together."
-              exit 1
-              ;;
-          esac
-
       - name: Install PostgreSQL 15 and some extensions
         if: steps.pg15cache.outputs.cache-hit != 'true'
         run: |
@@ -67,14 +41,12 @@ jobs:
           make PG_CONFIG=$HOME/pg15/bin/pg_config install -j$(nproc) > /dev/null
 
       - uses: actions/checkout@v3
-        with:
-          fetch-depth: 100
 
       - name: Build AGE
         id: build
         run: |
-          make PG_CONFIG=$HOME/pg15/bin/pg_config COPT=-Werror install -j$(nproc)
-
+          make PG_CONFIG=$HOME/pg15/bin/pg_config install -j$(nproc)
+        
       - name: Pull and build pgvector
         id: pgvector
         run: |
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 00000000..266df4ce
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,30 @@
+name: "Pull Request Labeler"
+on:
+- pull_request_target
+
+jobs:
+  triage:
+    permissions:
+      contents: read
+      pull-requests: write
+    runs-on: ubuntu-latest
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v3
+
+    - name: Apply branch labels
+      uses: actions/labeler@v5.0.0
+
+    - name: Apply label based on author
+      if: |
+        contains('["jrgemignani", "dehowef", "eyab" "rafsun42", "Zainab-Saad", "MuhammadTahaNaveed"]', github.event.pull_request.user.login)
+      uses: actions/github-script@v7
+      with:
+        script: |
+          const labelsToAdd = ['override-stale'];
+          github.rest.issues.addLabels({
+            issue_number: context.issue.number,
+            owner: context.repo.owner,
+            repo: context.repo.repo,
+            labels: labelsToAdd
+          });
diff --git a/.github/workflows/nodejs-driver.yaml b/.github/workflows/nodejs-driver.yaml
index 06ca2fb5..1f7ac273 100644
--- a/.github/workflows/nodejs-driver.yaml
+++ b/.github/workflows/nodejs-driver.yaml
@@ -22,9 +22,9 @@ jobs:
       run: docker compose up -d
 
     - name: Set up Node
-      uses: actions/setup-node@v4
+      uses: actions/setup-node@v3
       with:
-        node-version: 20
+        node-version: latest
 
     - name: Install dependencies
       run: npm install
diff --git a/.github/workflows/python-driver.yaml b/.github/workflows/python-driver.yaml
index aaf64bd1..db419556 100644
--- a/.github/workflows/python-driver.yaml
+++ b/.github/workflows/python-driver.yaml
@@ -22,22 +22,21 @@ jobs:
       run: docker compose up -d
 
     - name: Set up python
-      uses: actions/setup-python@v5
+      uses: actions/setup-python@v4
       with:
-        python-version: '3.12'
+        python-version: '3.10'
 
     - name: Install pre-requisites
       run: |
         sudo apt-get install python3-dev libpq-dev
-        pip install --no-binary psycopg -r requirements.txt
+        pip install -r requirements.txt
 
     - name: Build
       run: |
-        pip install .
+        python setup.py install
 
     - name: Test
       run: |
         python test_age_py.py -db "postgres" -u "postgres" -pass "agens"
         python test_networkx.py -db "postgres" -u "postgres" -pass "agens"
         python -m unittest -v test_agtypes.py
-        python -m unittest -v test_security.py
diff --git a/.gitignore b/.gitignore
index 98f4a7f9..a8e809dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
 *.o
-*.d
 *.so
 build.sh
 .idea
@@ -12,8 +11,5 @@ age--*.*.*.sql
 !age--*--*sql
 __pycache__
 **/__pycache__
-**/.venv
-**/apache_age_python.egg-info
 
 drivers/python/build
-*.bc
diff --git a/META.json b/META.json
index 86714cec..bb63a056 100644
--- a/META.json
+++ b/META.json
@@ -2,7 +2,7 @@
    "name": "ApacheAGE",
    "abstract": "Apache AGE is a PostgreSQL Extension that provides graph database functionality",
    "description": "Apache AGE is a PostgreSQL Extension that provides graph database functionality. AGE is an acronym for A Graph Extension, and is inspired by Bitnine's fork of PostgreSQL 10, AgensGraph, which is a multi-model database. The goal of the project is to create single storage that can handle both relational and graph model data so that users can use standard ANSI SQL along with openCypher, the Graph query language. A graph consists of a set of vertices (also called nodes) an [...]
-   "version": "1.8.0",
+   "version": "1.3.0",
    "maintainer": [
       "users@age.apache.org"
    ],
@@ -10,20 +10,20 @@
    "provides": {
       "ApacheAGE": {
          "abstract": "Apache AGE is a PostgreSQL Extension that provides graph database functionality",
-         "file": "age--1.8.0.sql",
+         "file": "age--1.3.0.sql",
          "docfile": "README.md",
-         "version": "1.8.0"
+         "version": "1.3.0"
       }
    },
    "prereqs": {
       "runtime": {
          "requires": {
-            "PostgreSQL": "15.0.0"
+            "PostgreSQL": "14.0.0"
          }
       }
    },
    "resources": {
-      "homepage": "https://github.com/apache/age/tree/PG15",
+      "homepage": "https://github.com/apache/age/tree/master",
       "bugtracker": {
          "web": "https://github.com/apache/age/issues"
       },
diff --git a/Makefile b/Makefile
index 2ea8f64e..3e73f3e6 100644
--- a/Makefile
+++ b/Makefile
@@ -15,99 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# ===========================================================================
-# Apache AGE extension build
-#
-# File layout (top to bottom):
-#   * Module
-#   * Upgrade regression-test support   (1/2: variables)
-#   * Extension SQL & data files
-#   * Regression test suite (REGRESS / REGRESS_OPTS)
-#   * PGXS include
-#   * Build rules
-#   * Upgrade regression-test support   (2/2: rules + installcheck lifecycle)
-#   * installcheck-existing (run against a running server)
-#   * help
-#
-# Common targets:
-#   all                    Build the extension (default)
-#   install                Install into the PostgreSQL tree
-#   installcheck           Run regression tests in a private temp instance
-#   installcheck-existing  Run regression tests against a running server
-#   clean                  Remove build artifacts
-#   help                   Show the target list
-# ===========================================================================
-
-# ===== Module =====
 MODULE_big = age
 
-# ===== Upgrade regression-test support (1/2: variables) =====
-#
-# This feature spans two sections (the PGXS include forces the split):
-#   * 1/2 (here, pre-include): variables -- must be defined before DATA,
-#     REGRESS, and EXTRA_CLEAN reference them.
-#   * 2/2 (below the PGXS include): build rules + installcheck lifecycle.
-#
-# Validates the upgrade template (age--<VER>--y.y.y.sql) by simulating an
-# extension version upgrade entirely within "make installcheck". The test:
-#
-#   1. Builds the default install SQL (age--<CURR>.sql) from current HEAD's
-#      sql/sql_files. This is what CREATE EXTENSION age installs.
-#   2. Builds a synthetic "initial" version install SQL from the version-bump
-#      commit in git history. This represents the pre-upgrade state.
-#   3. Stamps the upgrade template to upgrade from the initial version to the
-#      current version.
-#   4. Temporarily installs the synthetic files into the PG extension directory
-#      so that CREATE EXTENSION age VERSION '<INIT>' and ALTER EXTENSION
-#      age UPDATE TO '<CURR>' can find them.
-#   5. The age_upgrade regression test snapshots the ag_catalog schema from
-#      a fresh install, then installs at INIT, upgrades to CURR, and compares
-#      the catalog across seven system catalogs to detect missing, extra,
-#      or changed objects.
-#   6. The test SQL cleans up the synthetic files via a generated shell script.
-#
-# This forces developers to keep the upgrade template in sync: any SQL object
-# added after the version-bump commit must also appear in the template, or the
-# upgrade test will fail (the object will be missing after ALTER EXTENSION UPDATE).
-#
-# Because the default install SQL comes from HEAD, all non-upgrade tests
-# run with every SQL function registered — no functions are missing.
-#
-# Graceful degradation — the upgrade test is silently skipped when:
-#   - No git history (tarball build): AGE_VER_COMMIT is empty.
-#   - No upgrade template: age--<CURR>--y.y.y.sql does not exist.
-#   - A real (git-tracked) upgrade script from <CURR> already exists
-#     (e.g., age--1.7.0--1.8.0.sql is committed): the synthetic test is
-#     redundant because the real script ships with the extension.
-# Current version from age.control (e.g., "1.7.0")
-AGE_CURR_VER := $(shell awk -F"'" '/^default_version/ {print $$2}' age.control 2>/dev/null)
-# Git commit that last changed age.control — the "initial release" commit
-AGE_VER_COMMIT := $(shell git log -1 --format=%H -- age.control 2>/dev/null)
-# Synthetic initial version: current version with _initial suffix
-AGE_INIT_VER := $(AGE_CURR_VER)_initial
-# The upgrade template file (e.g., age--1.7.0--y.y.y.sql); empty if not present
-AGE_UPGRADE_TEMPLATE := $(wildcard age--$(AGE_CURR_VER)--y.y.y.sql)
-
-# Synthetic filenames — these are NOT installed permanently; they are temporarily
-# placed in $(SHAREDIR)/extension/ during installcheck and removed after.
-age_init_sql = $(if $(AGE_INIT_VER),age--$(AGE_INIT_VER).sql)
-age_upgrade_test_sql = $(if $(AGE_INIT_VER),age--$(AGE_INIT_VER)--$(AGE_CURR_VER).sql)
+age_sql = age--1.6.0.sql
 
-# Real (git-tracked, non-template) upgrade scripts FROM the current version.
-# If any exist (e.g., age--1.7.0--1.8.0.sql is committed), the synthetic
-# upgrade test is redundant because a real upgrade path already ships.
-# Uses git ls-files so untracked synthetic files are NOT matched.
-AGE_REAL_UPGRADE := $(shell git ls-files 'age--$(AGE_CURR_VER)--*.sql' 2>/dev/null | grep -v 'y\.y\.y')
-
-# Non-empty when ALL of these hold:
-#   1. Git history is available (AGE_VER_COMMIT non-empty)
-#   2. The upgrade template exists (AGE_UPGRADE_TEMPLATE non-empty)
-#   3. No real upgrade script from current version exists (AGE_REAL_UPGRADE empty)
-# When a real upgrade script ships, the test is skipped — the real script
-# supersedes the synthetic one and has its own validation path.
-AGE_HAS_UPGRADE_TEST = $(and $(AGE_VER_COMMIT),$(AGE_UPGRADE_TEMPLATE),$(if $(AGE_REAL_UPGRADE),,yes))
-
-# ===== Object files =====
 OBJS = src/backend/age.o \
        src/backend/catalog/ag_catalog.o \
        src/backend/catalog/ag_graph.o \
@@ -155,18 +66,13 @@ OBJS = src/backend/age.o \
        src/backend/utils/ag_func.o \
        src/backend/utils/graph_generation.o \
        src/backend/utils/cache/ag_cache.o \
-       src/backend/utils/cache/agehash.o \
        src/backend/utils/load/ag_load_labels.o \
        src/backend/utils/load/ag_load_edges.o \
        src/backend/utils/load/age_load.o \
+       src/backend/utils/load/libcsv.o \
        src/backend/utils/name_validation.o \
        src/backend/utils/ag_guc.o
 
-# Per-object header-dependency files (see "Automatic header-dependency
-# tracking" below the PGXS include). One .d is generated beside each .o.
-DEPFILES = $(OBJS:.o=.d)
-
-# ===== Extension SQL & data files =====
 EXTENSION = age
 
 # to allow cleaning of previous (old) age--.sql files
@@ -176,24 +82,13 @@ SQLS := $(shell cat sql/sql_files)
 SQLS := $(addprefix sql/,$(SQLS))
 SQLS := $(addsuffix .sql,$(SQLS))
 
-# Name of the generated install SQL (age--<version>.sql).
-# Derived from AGE_CURR_VER (read from age.control above) so the version
-# number lives in exactly one place.
-age_sql = age--$(AGE_CURR_VER).sql
-
 DATA_built = $(age_sql)
 
-# Git-tracked upgrade scripts shipped with the extension (e.g., age--1.6.0--1.7.0.sql).
-# Excludes the upgrade template (y.y.y) and the synthetic stamped test file.
-DATA = $(filter-out age--%--y.y.y.sql $(age_upgrade_test_sql),$(wildcard age--*--*.sql))
-
-# ===== Regression test suite =====
 # sorted in dependency order
 REGRESS = scan \
           graphid \
           agtype \
           agtype_hash_cmp \
-          agehash \
           catalog \
           cypher \
           expr \
@@ -205,7 +100,6 @@ REGRESS = scan \
           cypher_delete \
           cypher_with \
           cypher_vle \
-          age_shortest_path \
           cypher_union \
           cypher_call \
           cypher_merge \
@@ -218,53 +112,21 @@ REGRESS = scan \
           name_validation \
           jsonb_operators \
           list_comprehension \
-          predicate_functions \
-          pattern_expression \
-          age_reduce \
-          map_projection \
-          direct_field_access \
-          generated_columns \
-          security \
-          reserved_keyword_alias \
-          agtype_jsonb_cast \
-          containment_selectivity \
-          subgraph \
-          extension_security
+          map_projection
 
 ifneq ($(EXTRA_TESTS),)
   REGRESS += $(EXTRA_TESTS)
 endif
 
-# Extension upgrade test — included when git history is available, the upgrade
-# template exists, and no real upgrade script from the current version is
-# committed. Runs between "security" and "drop" in test order.
-ifneq ($(AGE_HAS_UPGRADE_TEST),)
-  REGRESS += age_upgrade
-endif
-
 REGRESS += drop
 
 srcdir=`pwd`
 
 ag_regress_dir = $(srcdir)/regress
-REGRESS_OPTS = --load-extension=age \
-               --inputdir=$(ag_regress_dir) \
-               --outputdir=$(ag_regress_dir) \
-               --temp-instance=$(ag_regress_dir)/instance \
-               --port=61958 \
-               --encoding=UTF-8 \
-               --temp-config $(ag_regress_dir)/age_regression.conf
+REGRESS_OPTS = --load-extension=age --inputdir=$(ag_regress_dir) --outputdir=$(ag_regress_dir) --temp-instance=$(ag_regress_dir)/instance --port=61958 --encoding=UTF-8 --temp-config $(ag_regress_dir)/age_regression.conf
 
 ag_regress_out = instance/ log/ results/ regression.*
-EXTRA_CLEAN = $(addprefix $(ag_regress_dir)/, $(ag_regress_out)) \
-              src/backend/parser/cypher_gram.c \
-              src/include/parser/cypher_gram_def.h \
-              src/include/parser/cypher_kwlist_d.h \
-              $(all_age_sql) \
-              $(age_init_sql) \
-              $(age_upgrade_test_sql) \
-              $(ag_regress_dir)/age_upgrade_cleanup.sh \
-              $(DEPFILES)
+EXTRA_CLEAN = $(addprefix $(ag_regress_dir)/, $(ag_regress_out)) src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h src/include/parser/cypher_kwlist_d.h $(all_age_sql)
 
 GEN_KEYWORDLIST = $(PERL) -I ./tools/ ./tools/gen_keywordlist.pl
 GEN_KEYWORDLIST_DEPS = ./tools/gen_keywordlist.pl tools/PerfectHash.pm
@@ -272,34 +134,10 @@ GEN_KEYWORDLIST_DEPS = ./tools/gen_keywordlist.pl tools/PerfectHash.pm
 ag_include_dir = $(srcdir)/src/include
 PG_CPPFLAGS = -I$(ag_include_dir) -I$(ag_include_dir)/parser
 
-# ===== PGXS =====
 PG_CONFIG ?= pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
 include $(PGXS)
 
-# ===== Automatic header-dependency tracking =====
-#
-# AGE lists OBJS explicitly, and PGXS's built-in .deps tracking only runs when
-# the *server* was built with --enable-depend (often off). Without the lines
-# below, editing a header does NOT rebuild the .c files that include it, leaving
-# STALE .o files. This is especially dangerous for node/struct headers: a stale
-# ag_nodes.o keeps an old node_size, so _readExtensibleNode under-allocates and
-# readNode corrupts the heap ("unrecognized node type: <garbage>").
-#
-# The compiler emits a .d file next to each object (-MMD = user headers only;
-# -MP adds phony targets so deleting a header does not break the build). With
-# "-o foo.o", -MMD writes "foo.d" automatically (no -MF, no basename clashes).
-# On servers that DO set --enable-depend, PGXS appends its own "-MF .deps/*.Po"
-# after $(CFLAGS) (last -MF wins), so this degrades cleanly to that mechanism.
-override CFLAGS += -MMD -MP
--include $(DEPFILES)
-
-# ===== Build rules =====
-
-# 32-bit platform support: pass SIZEOF_DATUM=4 to enable (e.g., make SIZEOF_DATUM=4)
-# When SIZEOF_DATUM=4, PASSEDBYVALUE is stripped from graphid type for pass-by-reference.
-# If not specified, normal 64-bit behavior is used (PASSEDBYVALUE preserved).
-
 src/backend/parser/cypher_keywords.o: src/include/parser/cypher_kwlist_d.h
 
 src/include/parser/cypher_kwlist_d.h: src/include/parser/cypher_kwlist.h $(GEN_KEYWORDLIST_DEPS)
@@ -307,146 +145,14 @@ src/include/parser/cypher_kwlist_d.h: src/include/parser/cypher_kwlist.h $(GEN_K
 
 src/include/parser/cypher_gram_def.h: src/backend/parser/cypher_gram.c
 
-#
-# The Cypher grammar uses GLR mode with a number of inherent shift/reduce
-# and reduce/reduce conflicts arising from the ambiguity between
-# parenthesized expressions and graph patterns (both start with '(').
-# GLR handles these correctly at runtime by forking at the conflict
-# point; %dprec annotations resolve cases where both forks succeed.
-#
-# We keep -Werror so any unexpected Bison warning (unused rules, undeclared
-# types, etc.) still fails the build; we downgrade only the two conflict
-# categories to plain warnings via -Wno-error=.  The exact conflict totals
-# are pinned by %expect / %expect-rr in cypher_gram.y, which Bison treats
-# as exact-match: any deviation fails the build and forces an audit of
-# the new conflicts.
-#
-src/backend/parser/cypher_gram.c: BISONFLAGS += --defines=src/include/parser/cypher_gram_def.h -Werror -Wno-error=conflicts-sr -Wno-error=conflicts-rr
+src/backend/parser/cypher_gram.c: BISONFLAGS += --defines=src/include/parser/cypher_gram_def.h
 
-src/backend/parser/cypher_parser.o: src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h
-src/backend/parser/cypher_parser.bc: src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h
-src/backend/parser/cypher_keywords.o: src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h
-src/backend/parser/cypher_keywords.bc: src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h
-src/backend/parser/ag_scanner.c: FLEX_NO_BACKUP=yes
+src/backend/parser/cypher_parser.o: src/backend/parser/cypher_gram.c
+src/backend/parser/cypher_keywords.o: src/backend/parser/cypher_gram.c
 
-# Build the default install SQL (age--<VER>.sql) from current HEAD's sql/sql_files.
-# This is what CREATE EXTENSION age installs — it contains ALL current functions.
-# Every non-upgrade regression test runs against this complete SQL.
-$(age_sql): $(SQLS)
-	@echo "Building install SQL: $@ from HEAD"
+$(age_sql):
 	@cat $(SQLS) > $@
-ifeq ($(SIZEOF_DATUM),4)
-	@echo "32-bit build: removing PASSEDBYVALUE from graphid type"
-	@sed 's/^  PASSEDBYVALUE,$$/  -- PASSEDBYVALUE removed for 32-bit (see Makefile)/' $@ > $@.tmp && mv $@.tmp $@
-endif
-
-# ===== Upgrade regression-test support (2/2: rules + installcheck lifecycle) =====
-#
-# Part 1/2 (variables) is above the PGXS include; the rules and target
-# hooks below must follow the include.
-#
-# --- Synthetic SQL rules ---
-# Build synthetic "initial" version install SQL from the version-bump commit.
-# This represents the pre-upgrade state — the SQL at the time the version was
-# bumped in age.control. Used only by the upgrade test.
-ifneq ($(AGE_HAS_UPGRADE_TEST),)
-$(age_init_sql): age.control
-	@echo "Building synthetic initial version install SQL: $@ from commit $(AGE_VER_COMMIT)"
-	@for f in $$(git show $(AGE_VER_COMMIT):sql/sql_files 2>/dev/null); do \
-		git show $(AGE_VER_COMMIT):sql/$${f}.sql 2>/dev/null; \
-	done > $@
-ifeq ($(SIZEOF_DATUM),4)
-	@sed 's/^  PASSEDBYVALUE,$$/  -- PASSEDBYVALUE removed for 32-bit (see Makefile)/' $@ > $@.tmp && mv $@.tmp $@
-endif
 
-# Stamp upgrade template as upgrade from initial to current version
-$(age_upgrade_test_sql): $(AGE_UPGRADE_TEMPLATE)
-	@echo "Stamping upgrade template: $< -> $@ ($(AGE_INIT_VER) -> $(AGE_CURR_VER))"
-	@sed -e "s/1\.X\.0/$(AGE_CURR_VER)/g" -e "s/y\.y\.y/$(AGE_CURR_VER)/g" $< > $@
-endif
-
-# --- installcheck lifecycle: stage synthetic files, then clean up ---
-#
-# Problem: The upgrade test needs age--<INIT>.sql and age--<INIT>--<CURR>.sql
-# in the PG extension directory for CREATE EXTENSION VERSION and ALTER
-# EXTENSION UPDATE to find them, but we must not leave them installed
-# permanently (they would confuse users).
-#
-# Solution: A Make prerequisite installs them before pg_regress runs, and the
-# test SQL removes them at the end via \! (shell escape in psql). A generated
-# cleanup script (regress/age_upgrade_cleanup.sh) contains the exact absolute
-# paths so the removal works regardless of the working directory. EXTRA_CLEAN
-# also removes them on "make clean" as a safety net.
-#
-# This adds a prerequisite to "installcheck" but does NOT override the PGXS
-# recipe, so there are no Makefile warnings.
-SHAREDIR = $(shell $(PG_CONFIG) --sharedir)
+src/backend/parser/ag_scanner.c: FLEX_NO_BACKUP=yes
 
 installcheck: export LC_COLLATE=C
-ifneq ($(AGE_HAS_UPGRADE_TEST),)
-.PHONY: _install_upgrade_test_files
-_install_upgrade_test_files: $(age_init_sql) $(age_upgrade_test_sql)  # Build, install synthetic files, generate cleanup script
-	@echo "Installing upgrade test files to $(SHAREDIR)/extension/"
-	@$(INSTALL_DATA) $(age_init_sql) $(age_upgrade_test_sql) '$(SHAREDIR)/extension/'
-	@printf '#!/bin/sh\nrm -f "$(SHAREDIR)/extension/$(age_init_sql)" "$(SHAREDIR)/extension/$(age_upgrade_test_sql)"\nrm -f "$(age_init_sql)" "$(age_upgrade_test_sql)" "$(ag_regress_dir)/age_upgrade_cleanup.sh"\n' > $(ag_regress_dir)/age_upgrade_cleanup.sh
-	@chmod +x $(ag_regress_dir)/age_upgrade_cleanup.sh
-
-installcheck: _install_upgrade_test_files
-endif
-
-# ===== installcheck-existing: run tests against a running server =====
-#
-# Runs the regression suite against an already-running PostgreSQL server
-# instead of the private temp instance built by "make installcheck".
-#
-# "make installcheck" appends --temp-instance to REGRESS_OPTS, so it builds
-# its own throwaway cluster and needs no running server.  This target instead
-# connects to the server selected by the standard libpq environment variables
-# (PGHOST/PGPORT/PGUSER); PGDATABASE defaults to contrib_regression.  Override
-# any of them on the command line, e.g.:
-#
-#     make installcheck-existing PGHOST=localhost PGPORT=5432 PGUSER=postgres
-#
-# pg_regress creates the database and loads the extension itself through
-# --load-extension=age -- exactly as the temp-instance path does -- so no
-# manual "CREATE EXTENSION" step is required.  The connecting role must be
-# allowed to CREATE DATABASE.
-#
-# This deliberately does NOT pass pg_regress --use-existing: that option skips
-# database creation (which also disables --load-extension) and is only needed
-# on clusters where the test role cannot CREATE DATABASE.  For that narrow
-# case, pre-create the database and extension and add --use-existing to
-# EXTRA_REGRESS_OPTS.
-#
-# The upgrade test (age_upgrade) is excluded here: it installs synthetic
-# extension files into the local $(SHAREDIR), which an existing or remote
-# server would not see.  Validate the upgrade path with "make installcheck".
-#
-# Locale note: locale-sensitive comparisons follow the existing server's own
-# collation (fixed at its initdb time); the temp-instance locale flags do not
-# apply to an already-running server.
-PGDATABASE ?= contrib_regression
-REGRESS_EXISTING = $(filter-out age_upgrade,$(REGRESS))
-
-.PHONY: installcheck-existing
-installcheck-existing:
-	$(pg_regress_installcheck) \
-	  --inputdir=$(ag_regress_dir) \
-	  --outputdir=$(ag_regress_dir) \
-	  --load-extension=age \
-	  $(if $(PGHOST),--host=$(PGHOST)) \
-	  $(if $(PGPORT),--port=$(PGPORT)) \
-	  $(if $(PGUSER),--user=$(PGUSER)) \
-	  --dbname=$(PGDATABASE) \
-	  $(REGRESS_EXISTING)
-
-# ===== Help =====
-.PHONY: help
-help:
-	@echo "Apache AGE - common make targets:"
-	@echo "  all                    Build the extension (default target)"
-	@echo "  install                Install the extension into the PostgreSQL tree"
-	@echo "  installcheck           Run the regression suite in a private temp instance"
-	@echo "  installcheck-existing  Run the regression suite against a running server"
-	@echo "  clean                  Remove build artifacts"
-	@echo "  help                   Show this message"
diff --git a/README.md b/README.md
index f9dd7e48..c0474976 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@
   </a>
   &nbsp;
   <a href="https://github.com/apache/age/releases">
-    <img src="https://img.shields.io/badge/Release-v1.8.0-FFA500?labelColor=gray&style=flat&link=https://github.com/apache/age/releases"/>
+    <img src="https://img.shields.io/badge/Release-v1.6.0-FFA500?labelColor=gray&style=flat&link=https://github.com/apache/age/releases"/>
   </a>
   &nbsp;
   <a href="https://www.postgresql.org/docs/15/index.html">
@@ -131,7 +131,7 @@ Apache AGE is intended to be simple to install and run. It can be installed with
 &nbsp;Install PostgreSQL
 </h4>
 
-This branch requires PostgreSQL 15.
+You will need to install an AGE compatible version of Postgres<a>, for now AGE supports Postgres 13, 14, 15, 16, & 17. Supporting the latest versions is on AGE roadmap.
 
 <h4>
 &nbsp;Installation via Package Manager
@@ -158,7 +158,7 @@ You can <a href="https://www.postgresql.org/ftp/source/"> download the Postgres
 
 Clone the <a href="https://github.com/apache/age">github repository</a> or download the <a href="https://github.com/apache/age/releases">download an official release.
 </a>
-Run the pg_config utility and check that it reports PostgreSQL 15.
+Run the pg_config utility and check the version of PostgreSQL. Currently, only PostgreSQL versions 13, 14, 15, 16, & 17 are supported. If you have any other version of Postgres, you will need to install PostgreSQL version 13, 14, 15, 16, or 17.
 <br>
     
 ```bash
@@ -221,115 +221,7 @@ LOAD 'age';
 SET search_path = ag_catalog, "$user", public;
 ```
 
-### Note on `ag_catalog` ownership
 
-AGE installs all of its objects into the `ag_catalog` schema. Install AGE
-(`CREATE EXTENSION age`) **before** granting the `CREATE` privilege on the
-database to other roles. A role that can create schemas could otherwise
-pre-create `ag_catalog` and own it; `CREATE EXTENSION age` therefore refuses to
-install when `ag_catalog` already exists and is owned by a different role. If you
-hit that error, drop the stray schema (`DROP SCHEMA ag_catalog CASCADE`) or
-transfer its ownership to the installing role, then retry.
-
-<h2><img height="20" src="/img/contents.svg">&nbsp;&nbsp;Using AGE with Non-Autocommit Clients (psycopg, JDBC, etc.)</h2>
-
-If you are using AGE from a database client that does **not** default to autocommit — most commonly `psycopg` v3 or JDBC — you must understand how PostgreSQL's transaction semantics apply to AGE's setup and DDL-like functions. Otherwise, you may see graphs or labels that appear to be created successfully, but are not visible from new connections.
-
-This is **not** a bug in AGE — it is standard PostgreSQL behavior. AGE's DDL-like functions write to the catalog, and catalog writes only become visible to other sessions after the enclosing transaction is committed.
-
-### What is and isn't transactional
-
-| Statement | Scope | Needs commit to be visible elsewhere? |
-|---|---|---|
-| `LOAD 'age'` | Session-local (loads the .so into the current backend) | No |
-| `SET search_path = ag_catalog, "$user", public` | Session-local | No |
-| `SELECT create_graph('g')` | **Writes** to `ag_graph` and creates a schema | **Yes** |
-| `SELECT create_vlabel('g', 'L')` / `create_elabel(...)` | **Writes** to `ag_label` and creates a table | **Yes** |
-| `SELECT drop_graph('g', true)` / `drop_label(...)` | **Writes** to catalog | **Yes** |
-| `SELECT load_labels_from_file(...)` / `load_edges_from_file(...)` | **Writes** to catalog + data | **Yes** |
-| `cypher('g', $$ CREATE (:L {...}) $$)` | **Writes** data | **Yes** |
-
-In a client that defaults to autocommit (e.g. `psql`), every statement commits automatically, so this is never noticed. In a non-autocommit client, the first statement you run implicitly opens a transaction that stays open until you call `commit()`, `rollback()`, or close the connection.
-
-### psycopg v3 — the "savepoint gotcha"
-
-The common pitfall is that `with connection.transaction():` in psycopg does **not** start a new top-level transaction when one is already open — it creates a **savepoint** inside the existing outer transaction. Releasing a savepoint is not a commit, so your `create_graph` write stays invisible to other sessions until the outer transaction is explicitly committed.
-
-#### ❌ Broken: graph is not visible from a new connection
-
-```python
-import psycopg
-
-params = {"host": "localhost", "port": 5432, "user": "postgres",
-          "password": "pw", "dbname": "mydb"}
-
-# --- First connection ---
-conn = psycopg.connect(**params)
-conn.execute("LOAD 'age'")                                      # implicitly opens a txn
-conn.execute("SET search_path = ag_catalog, '$user', public")
-
-with conn.transaction(), conn.cursor() as cur:                  # <-- SAVEPOINT, not a real txn
-    cur.execute("SELECT * FROM create_graph('my_graph')")
-# outer transaction is STILL OPEN here
-
-conn.close()  # outer transaction is rolled back on close → my_graph is gone
-
-# --- New connection ---
-conn = psycopg.connect(**params)
-conn.execute("LOAD 'age'")
-conn.execute("SET search_path = ag_catalog, '$user', public")
-with conn.cursor() as cur:
-    cur.execute("SELECT name FROM ag_graph;")
-    # 'my_graph' is NOT in the results
-```
-
-#### ✅ Fix 1: explicit `commit()` after setup
-
-```python
-conn = psycopg.connect(**params)
-conn.execute("LOAD 'age'")
-conn.execute("SET search_path = ag_catalog, '$user', public")
-conn.commit()   # <-- closes the implicit outer txn
-
-with conn.transaction(), conn.cursor() as cur:
-    cur.execute("SELECT * FROM create_graph('my_graph')")
-# this transaction block is now top-level and commits on exit
-conn.close()
-```
-
-#### ✅ Fix 2: enable autocommit on the connection
-
-```python
-conn = psycopg.connect(**params, autocommit=True)
-conn.execute("LOAD 'age'")
-conn.execute("SET search_path = ag_catalog, '$user', public")
-conn.execute("SELECT * FROM create_graph('my_graph')")          # commits immediately
-conn.close()
-```
-
-You can also toggle autocommit at runtime with `conn.set_autocommit(True)`.
-
-### JDBC
-
-JDBC connections also default to autocommit **true** per the JDBC spec, but many frameworks (Spring, etc.) flip it off. If you are running AGE DDL-like calls from JDBC, either:
-
-```java
-connection.setAutoCommit(true);
-// ... LOAD 'age'; SET search_path ...; SELECT create_graph(...);
-```
-
-or keep autocommit off and explicitly commit after DDL-like calls:
-
-```java
-stmt.execute("LOAD 'age'");
-stmt.execute("SET search_path = ag_catalog, \"$user\", public;");
-stmt.execute("SELECT create_graph('my_graph');");
-connection.commit();   // make the graph visible to other sessions
-```
-
-### Rule of thumb
-
-> If an AGE call creates, drops, or modifies a graph, label, vertex, edge, or property, it is a **transactional write**. In a non-autocommit client, it will not be visible to other sessions until you explicitly `commit()`.
 
 <h2><img height="20" src="/img/contents.svg">&nbsp;&nbsp;Quick Start</h2>
 
diff --git a/RELEASE b/RELEASE
index 3e8de226..94a4b3b6 100644
--- a/RELEASE
+++ b/RELEASE
@@ -15,125 +15,103 @@
 # specific language governing permissions and limitations
 # under the License.
 
-Release Notes for Apache AGE release 1.8.0 for PostgreSQL version 15
+Release Notes for Apache AGE release 1.6.0 for PostgreSQL version 15
 
 #
-# WARNING!
+#  WARNING!
 #
-# Always back up your database before executing any upgrade scripts.
+#  Since there are modifications to agtype gin operators, users who are
+#  upgrading will need to drop the gin indexes before running the upgrade
+#  script and recreate them afterwards.
 #
-# The 1.6.0 -> 1.8.0 upgrade creates indexes for existing labels and may
-# take a while for large graphs.
+#  As always, please backup your database prior to any upgrade.
 #
-# When upgrading from 1.5.0, drop agtype GIN indexes before running the
-# 1.5.0 -> 1.6.0 upgrade script and recreate them afterwards.
+#  WARNING!
 #
-# WARNING!
-#
-
-Apache AGE 1.8.0 - Release Notes
-
-Fix installcheck fetch-depth parameter to 100 (#2461)
-Fix segfault on CREATE/MERGE/SET with generated or extra label columns (#2458)
-Propagate null through unnest and single() three-valued logic (#2406)
-Add automatic header-dependency tracking to the Makefile (#2454)
-ci: pin Build/Regression runner to ubuntu-24.04 and guard Bison version for GLR grammar (#2445)
-Fix segfault and out-of-bounds reads in file loaders on malformed rows (#2453)
-Support outer references in reduce() fold bodies (#2448)
-Fix stack overflow and precision loss in toFloatList() conversion (#2451)
-Fix Node.js driver CI build broken by @types/node drift (#2452)
-Preserve null-valued keys in map literals (#2391) (#2412)
-Fix single-node labeled pattern expressions not filtering by label (#2443) (#2444)
-Support relationship-type filters and a minimum hop count (#2442)
-resolve subgraph staging sequences via regclass (#2446)
-Add reduce() list folding function (#2435)
-Support pattern expressions as boolean expressions (#2360)
-Add shortest_path / all_shortest_paths SRFs (#2430)
-cypher_with: add ORDER BY to non-deterministic RETURN queries (#2436)
-Make ag_catalog ownership and built-in resolution explicit (#2440)
-Makefile: add installcheck-existing target and improve readability (#2437)
-age_global_graph: stabilize regression tests (#2431)
-cypher_vle: add ORDER BY to non-deterministic RETURN queries (#2434)
-feature: add create_subgraph() (#2441)
-Make age extension usable from shared_preload_libraries (#2438)
-Fix locale-dependent string comparison in direct_field_access test (#2439)
-Fix VLE [*0..N] zero-hop self-binding when edge label is missing (#2382) (#2419)
-fix: remove pthread_mutex that causes self-deadlock on VLE queries (#2433)
-Restore contsel/contjoinsel for containment & key-existence operators (#2356) (#2417)
-perf: VLE hash-adjacency overhaul — agehash + flat-array VertexEdgeArray (#2421)
-python driver: preserve trailing quotes in agtype string values (#2425)
-perf(agtype): arena passthrough + binary-direct id extraction (#2424)
-Add vertex and edge composite types with direct field access optimization (#2303)
-perf: VLE terminal-qual rewrite (#2420)
-Add agtype <-> jsonb bidirectional casts (#350) (#2361)
-feat(python-driver): add public API for connection pooling and model dict conversion (#2374)
-Fix upgrade test: allow function removal (#2422)
-Zero-initialize parent_cpstate in analyze_cypher (#2423)
-Fix upgrade test: replace data-integrity checks with catalog comparison (#2403)
-Allow safe Cypher reserved keywords in alias positions (#2355) (#2415)
-Propagate null through agtype arithmetic operators (#2405)
-Update README.md (#2414)
-Add VLE semantics and cost model design note (#2349) (#2413)
-Fix property access on list comprehension / predicate loop variables (#2402)
-Add MERGE ON CREATE SET / ON MATCH SET support (#2347)
-Propagate null in agtype_access_slice bounds (#2400)
-VLE cache + performance improvements (#2376)
-CI: fail build on compiler and bison warnings (#2398)
-fix(python-driver): add null-guards in ANTLR parser and relax runtime version pin (#2372)
-Return an empty list from tail() for empty and singleton lists (#2399)
-Fix substring() crash when start-offset is NULL and length is supplied (#2401)
-fix(python-driver): quote-escape column aliases in buildCypher() (#2373)
-Implement predicate functions: all(), any(), none(), single() (#2359)
-Fix OPTIONAL MATCH dropping null-preserving rows with subquery WHERE (#2380)
-Python driver: Add `skip_load` parameter to skip `LOAD 'age'` statement (#2366)
-Fix upgrade test: build default install SQL from HEAD, not initial commit (#2397)
-Improve extension upgrade regression test (addendum to #2364) (#2377)
-Add missing include for PR: Add index scan (#2351) (#2379)
-Add index scan (#2351)
-Fix MATCH on brand-new label after CREATE returning 0 rows (#2341)
-Fix nondeterministic age_global_graph regression test (#2365)
-Add extension upgrade template regression test (#2364)
-Fix crash in PREPARE with property parameter when enable_containment is off (#2339)
-Fix entity_exists() CID visibility for CREATE + WITH + MERGE (#2343)
-Support doubled-quote escaping in Cypher string literals (issue #2222) (#2342)
-Fix MATCH after CREATE returning 0 rows (issue #2308) (#2340)
-Fix chained MERGE not seeing sibling MERGE's changes (#1446) (#2344)
-Fix VLE queries failing on read-only replicas (#2160) (#2345)
-Fix VLE NULL handling for chained OPTIONAL MATCH (#2337)
-fix incorrect variable assignment (#2336)
-Remove labeler github action (#2335)
-Fix ISO C90 forbids mixed declarations and code warning (#2334)
-Fix null pointer handling in array iteration (#2313)
-Fix security vulnerabilities in Node.js driver (#2329)
-Update python-driver security and formatting (#2330)
-Fix JDBC driver CI test failures (#2333)
-Add pg_upgrade support functions for PostgreSQL (#2326)
 
-Apache AGE 1.7.0 - Release Notes
+Apache AGE 1.6.0 - Release Notes
 
-Backport index ownership and header fixes for PostgreSQL 15 (#2315)
-Add RLS support and fix permission checks (#2309)
-Replace libcsv with pg COPY for csv loading (#2310)
-Fix Issue 1884: Ambiguous column reference (#2306)
-Upgrade Jest to v29 for node: protocol compatibility (#2307)
-Optimize vertex/edge field access with direct array indexing (#2302)
-feat: Add 32-bit platform support for graphid type (#2286)
-Fix and improve index.sql addendum (#2301)
-Fix and improve index.sql regression test coverage (#2300)
-Fix Issue 2289: handle empty list in IN expression (#2294)
-Revise README for Python driver updates (#2298)
-Makefile: fix race condition on cypher_gram_def.h (#2273)
-Restrict age_load commands (#2274)
-Migrate python driver configuration to pyproject.toml (#2272)
-Convert string to raw string to remove invalid escape sequence warning (#2267)
-Update grammar file for maintainability (#2270)
-Fix ORDER BY alias resolution with AS in Cypher queries (#2269)
-Fix possible memory and file descriptors leaks (#2258)
-Adjust 'could not find rte for' ERROR message (#2266)
-Fix Issue 2256: segmentation fault when calling coalesce function (#2259)
-Add index on id columns (#2117)
-Fix issue 2245 - Creating more than 41 vlabels causes crash in drop_graph (#2248)
-Fix issue 2243 - Regression in string concatenation (#2244)
-Add fast functions for checking edge uniqueness (#2227)
-Bump gopkg.in/yaml.v3 from 3.0.0 to 3.0.1 in /drivers/golang (#2212)
-Fix issue with CALL/YIELD for user defined and qualified functions. (#2217)
+     Fix issue 2205: left doesn't catch overflow (#2207)
+     Fix issue 2201: unexpected empty string behavior (#2203)
+     Add support for operators in cypher query (#2172)
+     Reimplement list comprehension (#2169)
+     Update labeler.yml (#2186)
+     Fix issue with the CI build and labeler (#2183)
+     Fix CSV import for edge with one property (#2175)
+     Remove stale bot and update .asf.yaml settings (#2171)
+     Prevent object access hook from accesing not installed namespace (#2161)
+     Fix CI build errors caused by missing dependencies (#2163)
+     Add support for external extensions (#2088)
+     Fix issue 2093: pfree() called with a NULL pointer (#2095)
+     Fix issue 1955 - List comprehension in WHERE clause (#2094)
+     Add support for fuzzystrmatch and other external extensions (#2083)
+     Fix memory leaks in functions part 1 (#2066)
+     Issue 1996 - Add agtype to json typecast (#2075)
+     Fix issue 2046: Memory leak during btree(agtype) (#2060)
+     Refactor Dockerfile to use multi-stage builds (#2004)
+     Revamp age csv loader (#2044)
+     Fix issue 2020: Memory leak (#2028)
+     Fix Issue 1907: SET on MERGE not storing edge properties (#2019)
+     Add EmitWarningsOnPlaceholders("age") (#1997)
+     Fix Issue 1988: How to update a property which is a keyword (#2005)
+     Fix obsolete docker-compose command in CIs (#2007)
+     Fix issue 1986: Failure creating label name close to MAX_LABEL_NAME_LEN (#1989)
+     Fix issue 1953 - PG Boolean used as AGTYPE object (#1959)
+     Add graph_exists function (#1958)
+     Fix issue 1956 - null key name passed. (#1957)
+     docs: add link to .NET open-source driver (#1938)
+     Add the `load_from_plugins` parameter in the Python driver to load AGE from the $libdir/plugins directory (#1935)
+     Fix issue 1910: Server crashes when using exists(vle path) (#1924)
+     Converted single line comments to multiline (#1908)
+     Add function is_valid_label_name (#1911) (#1912)
+     Fixes small typos in the python driver's README.md file (#1909)
+     Fix agtype_build_map to allow more than 50 pairs (#1901)
+     Agtype hash cmp (#1893)
+     Order some regression tests for stability on big-endian (#1892)
+     Update github stale action (#1891)
+     Make CALL YIELD grammar more precise (#1852)
+     Fix issue 1878 - Regression test failure with delete global graphs (#1881)
+     Corrected typos and grammatical errors in apache-age-basic.ipynb (#879)
+     Add workflow for stale issues and PRs (#1872)
+     Implement Returnless Unions in Subqueries (#1803)
+     [CI] Update docker image tags (#1865)
+     Add branch protection rules in .asf.yaml (#1854)
+     [CI] Update labeler github action (#1851)
+     Fix error using list comprehension with WITH * (#1838)
+     python driver psycopg3 (#1793)
+     Minor VLE and agtype_eq/ne performance updates (#1808)
+     Fix issue 1767: CREATE TABLE AS SELECT * FROM cypher, errors (#1799)
+     Implement Constraints on Subqueries (#1751)
+     Fix connection string in Python Driver (#1757)
+     Added integer conversion in toBoolean functions (#1199)
+     Update README.md (#1756)
+     Add the command graph_stats and improve VLE messaging for load (#1750)
+     Add helpful messages to the VLE subsystem (#1742)
+     Update README.md (#1728)
+     Added Networkx Support in python driver (#1716)
+     Remove duplicate check (#1740)
+     Fix Issue 1709 - MERGE creates incomplete vertices after the first one (#1721)
+     Fix shift/reduce conflict in grammar (#1719)
+     Fix Issue 1691 - MERGE incorrectly creates multiple vertices (#1718)
+     Implement map projection (#1710)
+     Add hooks for multi-arch builds on dockerhub (#1683)
+     Sample code for AGE-JDBC driver (#390)
+     Allow agtype_build_map to use AGTYPE keys (#1666)
+     Implement EXISTS Subquery      (#1562)
+     Fix Issue 1634: Setting all properties with map object causes error (#1637)
+     Fix Issue 1630: MERGE using array not working in some cases (#1636)
+     Implement list comprehension (#1610)
+     Update Go installation and add in parser files (#1582)
+     Add optional parameter '=' in property constraints (#1516)
+     Fix unsorted output of some queries in the cypher_match test (#1507)
+     Update age_load to make property value conversion optional (#1525)
+     Update the Go driver documentation, Linux installer, and CI (#1527)
+     Fix json serialization error in Python Driver (#1228)
+     Add template for upgrading between versions of Apache AGE (#1506)
+     Update age_load to load scalar property values with appropriate type (#1519)
+     Fix apache#1513 - Invalid variable reuse in CREATE and MERGE clause (#1515)
+     Clean up #included files in src/include directories (#1518)
+     Bump gopkg.in/yaml.v3 in /drivers/golang (#1202)
+     Clean up #included files in catalog & commands directories (#1514)
+     Clean up #included files in nodes, executor, & optimizer directories (#1509)
+     Correct cleanup of age--x.x.x.sql files (#1505)
diff --git a/age--1.6.0--1.8.0.sql b/age--1.6.0--1.8.0.sql
deleted file mode 100644
index 770e87ed..00000000
--- a/age--1.6.0--1.8.0.sql
+++ /dev/null
@@ -1,1238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
--- This will only work within a major version of PostgreSQL, not across
--- major versions.
-
--- complain if script is sourced in psql, rather than via ALTER EXTENSION
-\echo Use "ALTER EXTENSION age UPDATE TO '1.8.0'" to load this file. \quit
-
-CREATE FUNCTION ag_catalog._ag_enforce_edge_uniqueness2(graphid, graphid)
-    RETURNS bool
-    LANGUAGE c
-    STABLE
-PARALLEL SAFE
-as 'MODULE_PATHNAME';
-
-CREATE FUNCTION ag_catalog._ag_enforce_edge_uniqueness3(graphid, graphid, graphid)
-    RETURNS bool
-    LANGUAGE c
-    STABLE
-PARALLEL SAFE
-as 'MODULE_PATHNAME';
-
-CREATE FUNCTION ag_catalog._ag_enforce_edge_uniqueness4(graphid, graphid, graphid, graphid)
-    RETURNS bool
-    LANGUAGE c
-    STABLE
-PARALLEL SAFE
-as 'MODULE_PATHNAME';
-
--- Create indexes on id columns for existing labels
--- Vertex labels get PRIMARY KEY on id, Edge labels get indexes on start_id/end_id
-DO $$
-DECLARE
-    label_rec record;
-    schema_name text;
-    table_name text;
-    idx_exists boolean;
-    pk_exists boolean;
-    idx_name text;
-BEGIN
-    FOR label_rec IN
-        SELECT l.relation, l.kind
-        FROM ag_catalog.ag_label l
-    LOOP
-        SELECT n.nspname, c.relname INTO schema_name, table_name
-        FROM pg_class c
-        JOIN pg_namespace n ON c.relnamespace = n.oid
-        WHERE c.oid = label_rec.relation;
-
-        IF label_rec.kind = 'e' THEN
-            -- Edge: check/create index on start_id
-            SELECT EXISTS (
-                SELECT 1 FROM pg_index i
-                JOIN pg_class c ON c.oid = i.indexrelid
-                JOIN pg_am am ON am.oid = c.relam
-                JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = i.indkey[0]
-                WHERE i.indrelid = label_rec.relation
-                  AND a.attname = 'start_id'
-                  AND i.indpred IS NULL              -- not a partial index
-                  AND i.indexprs IS NULL             -- not an expression index
-                  AND am.amname = 'btree'            -- btree access method
-            ) INTO idx_exists;
-
-            IF NOT idx_exists THEN
-                EXECUTE format('CREATE INDEX %I ON %I.%I USING btree (start_id)',
-                    table_name || '_start_id_idx', schema_name, table_name);
-            END IF;
-
-            -- Edge: check/create index on end_id
-            SELECT EXISTS (
-                SELECT 1 FROM pg_index i
-                JOIN pg_class c ON c.oid = i.indexrelid
-                JOIN pg_am am ON am.oid = c.relam
-                JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = i.indkey[0]
-                WHERE i.indrelid = label_rec.relation
-                  AND a.attname = 'end_id'
-                  AND i.indpred IS NULL              -- not a partial index
-                  AND i.indexprs IS NULL             -- not an expression index
-                  AND am.amname = 'btree'            -- btree access method
-            ) INTO idx_exists;
-
-            IF NOT idx_exists THEN
-                EXECUTE format('CREATE INDEX %I ON %I.%I USING btree (end_id)',
-                    table_name || '_end_id_idx', schema_name, table_name);
-            END IF;
-        ELSE
-            -- Vertex: check/create PRIMARY KEY on id
-            SELECT EXISTS (
-                SELECT 1 FROM pg_constraint
-                WHERE conrelid = label_rec.relation AND contype = 'p'
-            ) INTO pk_exists;
-
-            IF NOT pk_exists THEN
-                -- Check if a usable unique index on id already exists
-                SELECT c.relname INTO idx_name
-                FROM pg_index i
-                JOIN pg_class c ON c.oid = i.indexrelid
-                JOIN pg_am am ON am.oid = c.relam
-                WHERE i.indrelid = label_rec.relation
-                  AND i.indisunique = true
-                  AND i.indpred IS NULL              -- not a partial index
-                  AND i.indexprs IS NULL             -- not an expression index
-                  AND am.amname = 'btree'            -- btree access method
-                  AND i.indnkeyatts = 1              -- single column index
-                  AND EXISTS (
-                      SELECT 1 FROM pg_attribute a
-                      WHERE a.attrelid = i.indrelid
-                        AND a.attnum = i.indkey[0]
-                        AND a.attname = 'id'
-                  )
-                LIMIT 1;
-
-                IF idx_name IS NOT NULL THEN
-                    -- Reuse existing unique index for primary key
-                    EXECUTE format('ALTER TABLE %I.%I ADD CONSTRAINT %I PRIMARY KEY USING INDEX %I',
-                        schema_name, table_name, table_name || '_pkey', idx_name);
-                ELSE
-                    -- Create new primary key
-                    EXECUTE format('ALTER TABLE %I.%I ADD PRIMARY KEY (id)',
-                        schema_name, table_name);
-                END IF;
-            END IF;
-        END IF;
-    END LOOP;
-END $$;
-
---
--- pg_upgrade support functions
---
--- These functions help users upgrade PostgreSQL major versions using pg_upgrade
--- while preserving Apache AGE graph data.
---
-
-CREATE FUNCTION ag_catalog.age_prepare_pg_upgrade()
-    RETURNS void
-    LANGUAGE plpgsql
-    -- Resolve built-in functions and operators from pg_catalog first so they
-    -- are not overridden by same-named objects defined in ag_catalog. The
-    -- ag_catalog objects referenced here are schema-qualified.
-    SET search_path = pg_catalog, ag_catalog
-    AS $function$
-DECLARE
-    graph_count integer;
-BEGIN
-    -- Check if namespace column is already oid type (already prepared)
-    IF EXISTS (
-        SELECT 1 FROM information_schema.columns
-        WHERE table_schema = 'ag_catalog'
-          AND table_name = 'ag_graph'
-          AND column_name = 'namespace'
-          AND data_type = 'oid'
-    ) THEN
-        RAISE NOTICE 'Database already prepared for pg_upgrade (namespace is oid type).';
-        RETURN;
-    END IF;
-
-    -- Drop existing backup table if it exists (from a previous failed attempt)
-    DROP TABLE IF EXISTS public._age_pg_upgrade_backup;
-
-    -- Create backup table with graph names mapped to namespace names
-    -- We store nspname directly (not regnamespace::text) to avoid quoting issues
-    -- Names survive pg_upgrade while OIDs don't
-    CREATE TABLE public._age_pg_upgrade_backup AS
-    SELECT
-        g.graphid AS old_graphid,
-        g.name AS graph_name,
-        n.nspname AS namespace_name
-    FROM ag_catalog.ag_graph g
-    JOIN pg_namespace n ON n.oid = g.namespace::oid;
-
-    SELECT count(*) INTO graph_count FROM public._age_pg_upgrade_backup;
-
-    RAISE NOTICE 'Created backup table public._age_pg_upgrade_backup with % graph(s)', graph_count;
-
-    -- Even with zero graphs, we still need to convert the column type
-    -- because the regnamespace type itself blocks pg_upgrade
-
-    -- Drop the existing regnamespace-based index
-    DROP INDEX IF EXISTS ag_catalog.ag_graph_namespace_index;
-
-    -- Convert namespace column from regnamespace to oid
-    ALTER TABLE ag_catalog.ag_graph
-        ALTER COLUMN namespace TYPE oid USING namespace::oid;
-
-    -- Recreate the index with oid type
-    CREATE UNIQUE INDEX ag_graph_namespace_index
-        ON ag_catalog.ag_graph USING btree (namespace);
-
-    -- Create a view for backward-compatible display of namespace as schema name
-    CREATE OR REPLACE VIEW ag_catalog.ag_graph_view AS
-    SELECT graphid, name, namespace::regnamespace AS namespace
-    FROM ag_catalog.ag_graph;
-
-    RAISE NOTICE 'Successfully prepared database for pg_upgrade.';
-    RAISE NOTICE 'The ag_graph.namespace column has been converted from regnamespace to oid.';
-    RAISE NOTICE 'You can now run pg_upgrade.';
-    RAISE NOTICE 'After pg_upgrade completes, run: SELECT age_finish_pg_upgrade();';
-END;
-$function$;
-
-COMMENT ON FUNCTION ag_catalog.age_prepare_pg_upgrade() IS
-'Prepares an AGE database for pg_upgrade by converting ag_graph.namespace from regnamespace to oid type. Run this before pg_upgrade.';
-
-CREATE FUNCTION ag_catalog.age_finish_pg_upgrade()
-    RETURNS void
-    LANGUAGE plpgsql
-    -- Resolve built-in functions and operators from pg_catalog first so they
-    -- are not overridden by same-named objects defined in ag_catalog. The
-    -- ag_catalog objects referenced here are schema-qualified.
-    SET search_path = pg_catalog, ag_catalog
-    AS $function$
-DECLARE
-    mapping_count integer;
-    updated_labels integer;
-    updated_graphs integer;
-BEGIN
-    -- Check if backup table exists
-    IF NOT EXISTS (
-        SELECT 1 FROM information_schema.tables
-        WHERE table_schema = 'public'
-          AND table_name = '_age_pg_upgrade_backup'
-    ) THEN
-        RAISE EXCEPTION 'Backup table public._age_pg_upgrade_backup not found. '
-            'Did you run age_prepare_pg_upgrade() before pg_upgrade?';
-    END IF;
-
-    -- Check if namespace column is oid type (was properly prepared)
-    IF NOT EXISTS (
-        SELECT 1 FROM information_schema.columns
-        WHERE table_schema = 'ag_catalog'
-          AND table_name = 'ag_graph'
-          AND column_name = 'namespace'
-          AND data_type = 'oid'
-    ) THEN
-        RAISE EXCEPTION 'ag_graph.namespace is not oid type. '
-            'Did you run age_prepare_pg_upgrade() before pg_upgrade?';
-    END IF;
-
-    -- Create temporary mapping table with old and new OIDs
-    CREATE TEMP TABLE _graphid_mapping AS
-    SELECT
-        b.old_graphid,
-        b.graph_name,
-        n.oid AS new_graphid
-    FROM public._age_pg_upgrade_backup b
-    JOIN pg_namespace n ON n.nspname = b.namespace_name;
-
-    GET DIAGNOSTICS mapping_count = ROW_COUNT;
-
-    -- Verify all backup rows were mapped (detect missing schemas)
-    DECLARE
-        backup_count integer;
-    BEGIN
-        SELECT count(*) INTO backup_count FROM public._age_pg_upgrade_backup;
-        IF mapping_count < backup_count THEN
-            RAISE EXCEPTION 'Only % of % graphs could be mapped. Some schema names may have changed or been dropped.',
-                mapping_count, backup_count;
-        END IF;
-    END;
-
-    -- Handle zero-graph case (still need to restore schema)
-    IF mapping_count = 0 THEN
-        RAISE NOTICE 'No graphs to remap (empty backup table).';
-        DROP TABLE _graphid_mapping;
-        -- Skip to schema restoration
-    ELSE
-        RAISE NOTICE 'Found % graph(s) to remap', mapping_count;
-
-        -- Temporarily drop foreign key constraint
-        ALTER TABLE ag_catalog.ag_label DROP CONSTRAINT IF EXISTS fk_graph_oid;
-
-        -- Update ag_label.graph references to use new OIDs
-        UPDATE ag_catalog.ag_label l
-        SET graph = m.new_graphid
-        FROM _graphid_mapping m
-        WHERE l.graph = m.old_graphid;
-
-        GET DIAGNOSTICS updated_labels = ROW_COUNT;
-        RAISE NOTICE 'Updated % label record(s)', updated_labels;
-
-        -- Update ag_graph.graphid and ag_graph.namespace to new OIDs
-        UPDATE ag_catalog.ag_graph g
-        SET graphid = m.new_graphid,
-            namespace = m.new_graphid
-        FROM _graphid_mapping m
-        WHERE g.graphid = m.old_graphid;
-
-        GET DIAGNOSTICS updated_graphs = ROW_COUNT;
-        RAISE NOTICE 'Updated % graph record(s)', updated_graphs;
-
-        -- Restore foreign key constraint
-        ALTER TABLE ag_catalog.ag_label
-        ADD CONSTRAINT fk_graph_oid
-            FOREIGN KEY(graph) REFERENCES ag_catalog.ag_graph(graphid);
-
-        -- Clean up temporary mapping table
-        DROP TABLE _graphid_mapping;
-
-        RAISE NOTICE 'Successfully completed pg_upgrade OID remapping.';
-    END IF;
-
-    --
-    -- Restore original schema (revert namespace to regnamespace)
-    --
-    RAISE NOTICE 'Restoring original schema...';
-
-    -- Drop the view (no longer needed with regnamespace)
-    DROP VIEW IF EXISTS ag_catalog.ag_graph_view;
-
-    -- Drop the existing oid-based index
-    DROP INDEX IF EXISTS ag_catalog.ag_graph_namespace_index;
-
-    -- Convert namespace column back to regnamespace
-    ALTER TABLE ag_catalog.ag_graph
-        ALTER COLUMN namespace TYPE regnamespace USING namespace::regnamespace;
-
-    -- Recreate the index with regnamespace type
-    CREATE UNIQUE INDEX ag_graph_namespace_index
-        ON ag_catalog.ag_graph USING btree (namespace);
-
-    RAISE NOTICE 'Successfully restored ag_graph.namespace to regnamespace type.';
-
-    --
-    -- Invalidate AGE's internal caches by touching each graph's namespace
-    -- AGE registers a syscache callback on NAMESPACEOID, so altering a schema
-    -- triggers cache invalidation. This ensures cypher queries work immediately
-    -- without requiring a session reconnect.
-    --
-    -- We use xact-level advisory lock (auto-released at transaction end)
-    -- and preserve original schema ownership.
-    --
-    RAISE NOTICE 'Invalidating AGE caches...';
-    PERFORM pg_catalog.pg_advisory_xact_lock(pg_catalog.hashtext('age_finish_pg_upgrade'));
-    DECLARE
-        graph_rec RECORD;
-        cache_invalidated boolean := false;
-    BEGIN
-        FOR graph_rec IN
-            SELECT n.nspname AS ns_name, r.rolname AS owner_name
-            FROM ag_catalog.ag_graph g
-            JOIN pg_namespace n ON n.oid = g.namespace
-            JOIN pg_roles r ON r.oid = n.nspowner
-        LOOP
-            BEGIN
-                -- Touch schema by changing owner to current_user then back to original
-                -- This triggers cache invalidation without permanently changing ownership
-                EXECUTE pg_catalog.format('ALTER SCHEMA %I OWNER TO %I', graph_rec.ns_name, current_user);
-                EXECUTE pg_catalog.format('ALTER SCHEMA %I OWNER TO %I', graph_rec.ns_name, graph_rec.owner_name);
-                cache_invalidated := true;
-            EXCEPTION WHEN insufficient_privilege THEN
-                -- If we can't change ownership, skip this schema
-                -- The cache will be invalidated on first use anyway
-                RAISE NOTICE 'Could not invalidate cache for schema % (insufficient privileges)', graph_rec.ns_name;
-            END;
-        END LOOP;
-        IF NOT cache_invalidated AND (SELECT count(*) FROM ag_catalog.ag_graph) > 0 THEN
-            RAISE NOTICE 'Cache invalidation skipped. You may need to reconnect for cypher queries to work.';
-        END IF;
-    END;
-
-    -- Now that all steps succeeded, clean up the backup table
-    DROP TABLE IF EXISTS public._age_pg_upgrade_backup;
-
-    RAISE NOTICE '';
-    RAISE NOTICE 'pg_upgrade complete. All graph data has been preserved.';
-END;
-$function$;
-
-COMMENT ON FUNCTION ag_catalog.age_finish_pg_upgrade() IS
-'Completes pg_upgrade by remapping stale OIDs and restoring the original schema. Run this after pg_upgrade.';
-
-CREATE FUNCTION ag_catalog.age_revert_pg_upgrade_changes()
-    RETURNS void
-    LANGUAGE plpgsql
-    -- Resolve built-in functions and operators from pg_catalog first so they
-    -- are not overridden by same-named objects defined in ag_catalog. The
-    -- ag_catalog objects referenced here are schema-qualified.
-    SET search_path = pg_catalog, ag_catalog
-    AS $function$
-BEGIN
-    -- Check if namespace column is oid type (needs reverting)
-    IF NOT EXISTS (
-        SELECT 1 FROM information_schema.columns
-        WHERE table_schema = 'ag_catalog'
-          AND table_name = 'ag_graph'
-          AND column_name = 'namespace'
-          AND data_type = 'oid'
-    ) THEN
-        RAISE NOTICE 'ag_graph.namespace is already regnamespace type. Nothing to revert.';
-        RETURN;
-    END IF;
-
-    -- Drop the view (no longer needed with regnamespace)
-    DROP VIEW IF EXISTS ag_catalog.ag_graph_view;
-
-    -- Drop the existing oid-based index
-    DROP INDEX IF EXISTS ag_catalog.ag_graph_namespace_index;
-
-    -- Convert namespace column back to regnamespace
-    ALTER TABLE ag_catalog.ag_graph
-        ALTER COLUMN namespace TYPE regnamespace USING namespace::regnamespace;
-
-    -- Recreate the index with regnamespace type
-    CREATE UNIQUE INDEX ag_graph_namespace_index
-        ON ag_catalog.ag_graph USING btree (namespace);
-
-    --
-    -- Invalidate AGE's internal caches by touching each graph's namespace
-    -- We use xact-level advisory lock and preserve original ownership
-    --
-    PERFORM pg_catalog.pg_advisory_xact_lock(pg_catalog.hashtext('age_revert_pg_upgrade'));
-    DECLARE
-        graph_rec RECORD;
-    BEGIN
-        FOR graph_rec IN
-            SELECT n.nspname AS ns_name, r.rolname AS owner_name
-            FROM ag_catalog.ag_graph g
-            JOIN pg_namespace n ON n.oid = g.namespace
-            JOIN pg_roles r ON r.oid = n.nspowner
-        LOOP
-            BEGIN
-                -- Touch schema by changing owner to current_user then back to original
-                EXECUTE pg_catalog.format('ALTER SCHEMA %I OWNER TO %I', graph_rec.ns_name, current_user);
-                EXECUTE pg_catalog.format('ALTER SCHEMA %I OWNER TO %I', graph_rec.ns_name, graph_rec.owner_name);
-            EXCEPTION WHEN insufficient_privilege THEN
-                RAISE NOTICE 'Could not invalidate cache for schema % (insufficient privileges)', graph_rec.ns_name;
-            END;
-        END LOOP;
-    END;
-
-    RAISE NOTICE 'Successfully reverted ag_graph.namespace to regnamespace type.';
-    RAISE NOTICE '';
-    RAISE NOTICE 'Upgrade preparation has been cancelled.';
-    RAISE NOTICE 'You may want to drop the backup table: DROP TABLE IF EXISTS public._age_pg_upgrade_backup;';
-END;
-$function$;
-
-COMMENT ON FUNCTION ag_catalog.age_revert_pg_upgrade_changes() IS
-'Reverts schema changes if you need to cancel after age_prepare_pg_upgrade() but before pg_upgrade. Not needed after age_finish_pg_upgrade().';
-
-CREATE FUNCTION ag_catalog.age_pg_upgrade_status()
-    RETURNS TABLE (
-        status text,
-        namespace_type text,
-        graph_count bigint,
-        backup_exists boolean,
-        message text
-    )
-    LANGUAGE plpgsql
-    -- Resolve built-in functions and operators from pg_catalog first so they
-    -- are not overridden by same-named objects defined in ag_catalog. The
-    -- ag_catalog objects referenced here are schema-qualified.
-    SET search_path = pg_catalog, ag_catalog
-    AS $function$
-DECLARE
-    ns_type text;
-    g_count bigint;
-    backup_exists boolean;
-BEGIN
-    -- Get namespace column type
-    SELECT data_type INTO ns_type
-    FROM information_schema.columns
-    WHERE table_schema = 'ag_catalog'
-      AND table_name = 'ag_graph'
-      AND column_name = 'namespace';
-
-    -- Get graph count
-    SELECT count(*) INTO g_count FROM ag_catalog.ag_graph;
-
-    -- Check for backup table
-    SELECT EXISTS(
-        SELECT 1 FROM information_schema.tables
-        WHERE table_schema = 'public'
-          AND table_name = '_age_pg_upgrade_backup'
-    ) INTO backup_exists;
-
-    -- Determine status and message
-    IF ns_type = 'regnamespace' AND NOT backup_exists THEN
-        -- Normal state - ready for use, needs prep before pg_upgrade
-        RETURN QUERY SELECT
-            'NORMAL'::text,
-            ns_type,
-            g_count,
-            backup_exists,
-            'Run SELECT age_prepare_pg_upgrade(); before pg_upgrade'::text;
-    ELSIF ns_type = 'regnamespace' AND backup_exists THEN
-        -- Unusual state - backup exists but schema wasn't converted
-        RETURN QUERY SELECT
-            'WARNING'::text,
-            ns_type,
-            g_count,
-            backup_exists,
-            'Backup table exists but schema not converted. Run age_prepare_pg_upgrade() again.'::text;
-    ELSIF ns_type = 'oid' AND backup_exists THEN
-        -- Prepared and ready for pg_upgrade, or awaiting finish after pg_upgrade
-        RETURN QUERY SELECT
-            'PREPARED - AWAITING FINISH'::text,
-            ns_type,
-            g_count,
-            backup_exists,
-            'After pg_upgrade, run SELECT age_finish_pg_upgrade();'::text;
-    ELSE
-        -- oid type without backup - manually converted or partial state
-        RETURN QUERY SELECT
-            'CONVERTED'::text,
-            ns_type,
-            g_count,
-            backup_exists,
-            'Namespace is oid type. If upgrading, ensure backup table exists.'::text;
-    END IF;
-END;
-$function$;
-
-COMMENT ON FUNCTION ag_catalog.age_pg_upgrade_status() IS
-'Returns the current pg_upgrade readiness status of the AGE installation.';
-
---
--- VLE cache invalidation trigger function
--- Installed on graph label tables to catch SQL-level mutations
--- and increment the per-graph version counter for VLE cache invalidation.
---
-CREATE FUNCTION ag_catalog.age_invalidate_graph_cache()
-    RETURNS trigger
-    LANGUAGE c
-AS 'MODULE_PATHNAME';
-
---
--- Install the cache invalidation trigger on all pre-existing label tables.
--- New label tables created after this upgrade will get the trigger
--- automatically via label_commands.c. This DO block handles tables
--- that were created before the upgrade.
---
-DO $$
-DECLARE
-    r RECORD;
-BEGIN
-    FOR r IN
-        SELECT n.nspname AS schema_name, c.relname AS table_name
-        FROM ag_catalog.ag_label l
-        JOIN pg_catalog.pg_class c ON c.oid = l.relation
-        JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
-        WHERE l.name != '_ag_label_vertex'
-          AND l.name != '_ag_label_edge'
-    LOOP
-        -- Skip if trigger already exists on this table
-        IF NOT EXISTS (
-            SELECT 1 FROM pg_catalog.pg_trigger t
-            JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid
-            JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
-            WHERE n.nspname = r.schema_name
-              AND c.relname = r.table_name
-              AND t.tgname = '_age_cache_invalidate'
-        )
-        THEN
-            EXECUTE pg_catalog.format(
-                'CREATE TRIGGER _age_cache_invalidate '
-                'AFTER INSERT OR UPDATE OR DELETE OR TRUNCATE '
-                'ON %I.%I '
-                'FOR EACH STATEMENT '
-                'EXECUTE FUNCTION ag_catalog.age_invalidate_graph_cache()',
-                r.schema_name, r.table_name
-            );
-        END IF;
-    END LOOP;
-END;
-$$;
-
---
--- agtype <-> jsonb bidirectional casts
---
-
--- agtype -> jsonb (explicit)
--- Uses json intermediate (agtype_to_json -> json::jsonb) because agtype
--- extends jsonb's binary format with types (AGTV_INTEGER, AGTV_FLOAT,
--- AGTV_VERTEX, AGTV_EDGE, AGTV_PATH) that jsonb does not recognize.
-CREATE FUNCTION ag_catalog.agtype_to_jsonb(agtype)
-    RETURNS jsonb
-    LANGUAGE sql
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'SELECT ag_catalog.agtype_to_json($1)::jsonb';
-
-CREATE CAST (agtype AS jsonb)
-    WITH FUNCTION ag_catalog.agtype_to_jsonb(agtype);
-
--- jsonb -> agtype (explicit)
-CREATE FUNCTION ag_catalog.jsonb_to_agtype(jsonb)
-    RETURNS agtype
-    LANGUAGE sql
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'SELECT $1::text::agtype';
-
-CREATE CAST (jsonb AS agtype)
-    WITH FUNCTION ag_catalog.jsonb_to_agtype(jsonb);
-
---
--- S4: VLE SRF signature change
---
--- The age_vle SRF now emits start_id and end_id as scalar graphid columns
--- alongside the existing `edges` column. This allows the cypher transformer
--- to rewrite terminal-edge match quals as plain integer equalities,
--- removing the per-row age_match_vle_terminal_edge and age_match_two_vle_edges
--- function calls from VLE query plans.  Both qual functions are dropped.
---
--- BREAKING CHANGE for any external SQL that called age_vle(...) directly
--- and relied on `RETURNS SETOF agtype`, or called age_match_vle_terminal_edge
--- / age_match_two_vle_edges directly.  Internal AGE callers (the cypher
--- transformer) are not affected.
---
-DROP FUNCTION IF EXISTS ag_catalog.age_match_vle_terminal_edge(variadic "any");
-DROP FUNCTION IF EXISTS ag_catalog.age_match_two_vle_edges(agtype, agtype);
-
-DROP FUNCTION IF EXISTS ag_catalog.age_vle(agtype, agtype, agtype, agtype,
-                                           agtype, agtype, agtype);
-DROP FUNCTION IF EXISTS ag_catalog.age_vle(agtype, agtype, agtype, agtype,
-                                           agtype, agtype, agtype, agtype);
-
-CREATE FUNCTION ag_catalog.age_vle(IN agtype, IN agtype, IN agtype, IN agtype,
-                                   IN agtype, IN agtype, IN agtype,
-                                   OUT edges    agtype,
-                                   OUT start_id graphid,
-                                   OUT end_id   graphid)
-    RETURNS SETOF record
-LANGUAGE C
-STABLE
-CALLED ON NULL INPUT
-PARALLEL UNSAFE
-AS 'MODULE_PATHNAME';
-
-CREATE FUNCTION ag_catalog.age_vle(IN agtype, IN agtype, IN agtype, IN agtype,
-                                   IN agtype, IN agtype, IN agtype, IN agtype,
-                                   OUT edges    agtype,
-                                   OUT start_id graphid,
-                                   OUT end_id   graphid)
-    RETURNS SETOF record
-LANGUAGE C
-STABLE
-CALLED ON NULL INPUT
-PARALLEL UNSAFE
-AS 'MODULE_PATHNAME';
-
--- Unweighted (hop-count) shortest path between two vertices, computed over the
--- cached global graph adjacency via BFS. Returns a single path (0 or 1 rows).
--- Argument order mirrors the Cypher shortestPath() pattern
--- (a)-[:type*min_hops..max_hops]->(b):
---   (graph_name, start, end, edge_types, direction, min_hops, max_hops)
-CREATE FUNCTION ag_catalog.age_shortest_path(IN agtype, IN agtype, IN agtype,
-                                             IN agtype DEFAULT NULL,
-                                             IN agtype DEFAULT NULL,
-                                             IN agtype DEFAULT NULL,
-                                             IN agtype DEFAULT NULL)
-    RETURNS SETOF agtype
-LANGUAGE C
-STABLE
-CALLED ON NULL INPUT
-PARALLEL UNSAFE
-AS 'MODULE_PATHNAME';
-
--- All unweighted shortest paths between two vertices (one path per row).
--- Same argument order as age_shortest_path.
-CREATE FUNCTION ag_catalog.age_all_shortest_paths(IN agtype, IN agtype, IN agtype,
-                                                  IN agtype DEFAULT NULL,
-                                                  IN agtype DEFAULT NULL,
-                                                  IN agtype DEFAULT NULL,
-                                                  IN agtype DEFAULT NULL)
-    RETURNS SETOF agtype
-LANGUAGE C
-STABLE
-CALLED ON NULL INPUT
-PARALLEL UNSAFE
-AS 'MODULE_PATHNAME';
-
---
--- Composite types for vertex and edge
---
-CREATE TYPE ag_catalog.vertex AS (
-    id graphid,
-    label agtype,
-    properties agtype
-);
-
-CREATE TYPE ag_catalog.edge AS (
-    id graphid,
-    label agtype,
-    end_id graphid,
-    start_id graphid,
-    properties agtype
-);
-
---
--- vertex/edge to agtype cast functions
---
-CREATE FUNCTION ag_catalog.vertex_to_agtype(vertex)
-    RETURNS agtype
-    LANGUAGE c
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
-CREATE FUNCTION ag_catalog.edge_to_agtype(edge)
-    RETURNS agtype
-    LANGUAGE c
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
---
--- Implicit casts from vertex/edge to agtype
---
-CREATE CAST (vertex AS agtype)
-    WITH FUNCTION ag_catalog.vertex_to_agtype(vertex)
-AS IMPLICIT;
-
-CREATE CAST (edge AS agtype)
-    WITH FUNCTION ag_catalog.edge_to_agtype(edge)
-AS IMPLICIT;
-
-CREATE FUNCTION ag_catalog.vertex_to_json(vertex)
-    RETURNS json
-    LANGUAGE c
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
-CREATE FUNCTION ag_catalog.edge_to_json(edge)
-    RETURNS json
-    LANGUAGE c
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
-CREATE CAST (vertex AS json)
-    WITH FUNCTION ag_catalog.vertex_to_json(vertex);
-
-CREATE CAST (edge AS json)
-    WITH FUNCTION ag_catalog.edge_to_json(edge);
-
-CREATE FUNCTION ag_catalog.vertex_to_jsonb(vertex)
-    RETURNS jsonb
-    LANGUAGE c
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
-CREATE FUNCTION ag_catalog.edge_to_jsonb(edge)
-    RETURNS jsonb
-    LANGUAGE c
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
-CREATE CAST (vertex AS jsonb)
-    WITH FUNCTION ag_catalog.vertex_to_jsonb(vertex);
-
-CREATE CAST (edge AS jsonb)
-    WITH FUNCTION ag_catalog.edge_to_jsonb(edge);
-
---
--- Equality operators for vertex and edge (compare by id)
---
-CREATE FUNCTION ag_catalog.vertex_eq(vertex, vertex)
-    RETURNS boolean
-    LANGUAGE sql
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS $$ SELECT $1.id = $2.id $$;
-
-CREATE OPERATOR = (
-    FUNCTION = ag_catalog.vertex_eq,
-    LEFTARG = vertex,
-    RIGHTARG = vertex,
-    COMMUTATOR = =,
-    NEGATOR = <>,
-    RESTRICT = eqsel,
-    JOIN = eqjoinsel
-);
-
-CREATE FUNCTION ag_catalog.vertex_ne(vertex, vertex)
-    RETURNS boolean
-    LANGUAGE sql
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS $$ SELECT $1.id <> $2.id $$;
-
-CREATE OPERATOR <> (
-    FUNCTION = ag_catalog.vertex_ne,
-    LEFTARG = vertex,
-    RIGHTARG = vertex,
-    COMMUTATOR = <>,
-    NEGATOR = =,
-    RESTRICT = neqsel,
-    JOIN = neqjoinsel
-);
-
-CREATE FUNCTION ag_catalog.edge_eq(edge, edge)
-    RETURNS boolean
-    LANGUAGE sql
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS $$ SELECT $1.id = $2.id $$;
-
-CREATE OPERATOR = (
-    FUNCTION = ag_catalog.edge_eq,
-    LEFTARG = edge,
-    RIGHTARG = edge,
-    COMMUTATOR = =,
-    NEGATOR = <>,
-    RESTRICT = eqsel,
-    JOIN = eqjoinsel
-);
-
-CREATE FUNCTION ag_catalog.edge_ne(edge, edge)
-    RETURNS boolean
-    LANGUAGE sql
-    IMMUTABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS $$ SELECT $1.id <> $2.id $$;
-
-CREATE OPERATOR <> (
-    FUNCTION = ag_catalog.edge_ne,
-    LEFTARG = edge,
-    RIGHTARG = edge,
-    COMMUTATOR = <>,
-    NEGATOR = =,
-    RESTRICT = neqsel,
-    JOIN = neqjoinsel
-);
-
---
--- Drop and recreate _label_name with new return type (cstring -> agtype)
---
-DROP FUNCTION IF EXISTS ag_catalog._label_name(oid, graphid);
-
-CREATE FUNCTION ag_catalog._label_name(graph_oid oid, graphid)
-    RETURNS agtype
-    LANGUAGE c
-    IMMUTABLE
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
---
--- Drop and recreate _agtype_build_vertex with new signature (cstring -> agtype for label)
---
-DROP FUNCTION IF EXISTS ag_catalog._agtype_build_vertex(graphid, cstring, agtype);
-
-CREATE FUNCTION ag_catalog._agtype_build_vertex(graphid, agtype, agtype)
-    RETURNS agtype
-    LANGUAGE c
-    IMMUTABLE
-CALLED ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
---
--- Drop and recreate _agtype_build_edge with new signature (cstring -> agtype for label)
---
-DROP FUNCTION IF EXISTS ag_catalog._agtype_build_edge(graphid, graphid, graphid, cstring, agtype);
-
-CREATE FUNCTION ag_catalog._agtype_build_edge(graphid, graphid, graphid,
-                                              agtype, agtype)
-    RETURNS agtype
-    LANGUAGE c
-    IMMUTABLE
-CALLED ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
---
--- Helper function for optimized startNode/endNode
---
-CREATE FUNCTION ag_catalog._get_vertex_by_graphid(text, graphid)
-    RETURNS agtype
-    LANGUAGE c
-    STABLE
-RETURNS NULL ON NULL INPUT
-PARALLEL SAFE
-AS 'MODULE_PATHNAME';
-
--- Internal selftest for the agehash open-addressing hashtable. Returns "OK"
--- on success or "FAIL: ..." with a diagnostic message. Intended for the
--- agehash regression test only.
-CREATE FUNCTION ag_catalog._agehash_self_test()
-    RETURNS text
-    LANGUAGE c
-    VOLATILE
-    PARALLEL UNSAFE
-AS 'MODULE_PATHNAME';
-
---
--- Issue #2356: rebind containment and key-existence operators to the
--- lightweight contsel / contjoinsel selectivity estimators.
---
--- @>, <@, @>>, <<@, ?, ?|, ?& on agtype were bound to matchingsel /
--- matchingjoinsel. During planning matchingsel invokes the operator's
--- underlying function (agtype_contains) once per pg_statistic MCV entry and
--- histogram bin; with a realistic default_statistics_target that planning
--- cost dominates simple point queries (the regression reported in #2356).
---
--- contsel / contjoinsel return fixed selectivity constants without calling the
--- operator function, so planning is constant-time. This is a deliberate
--- planning-speed vs. estimate-accuracy trade-off. Note it DIVERGES from
--- PostgreSQL core, which keeps jsonb's @>, <@, ?, ?|, ?& on matchingsel /
--- matchingjoinsel; it is an AGE-specific choice favoring workloads where these
--- operators appear in selective point lookups.
---
-ALTER OPERATOR ag_catalog.@>(agtype, agtype)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.<@(agtype, agtype)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.@>>(agtype, agtype)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.<<@(agtype, agtype)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.?(agtype, text)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.?(agtype, agtype)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.?|(agtype, text[])
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.?|(agtype, agtype)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.?&(agtype, text[])
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-ALTER OPERATOR ag_catalog.?&(agtype, agtype)
-    SET (RESTRICT = contsel, JOIN = contjoinsel);
-
---
--- create_subgraph(): materialized subgraph extraction (see sql/age_subgraph.sql).
--- Induced-subgraph semantics matching Neo4j GDS gds.graph.filter(): a vertex is
--- kept iff node_filter holds ('*' = all); an edge is kept iff relationship_filter
--- holds AND both endpoints are kept. Produces a persistent, Cypher-queryable graph.
---
-CREATE FUNCTION ag_catalog.create_subgraph(new_graph name,
-                                           from_graph name,
-                                           node_filter text DEFAULT '*',
-                                           relationship_filter text DEFAULT '*')
-    RETURNS TABLE(node_count bigint, relationship_count bigint)
-    LANGUAGE plpgsql
-    VOLATILE
-    SET search_path = ag_catalog, pg_catalog
-    AS $function$
-DECLARE
-    from_oid oid;
-    new_oid  oid;
-    v_node_count bigint := 0;
-    v_rel_count  bigint := 0;
-    rec RECORD;
-    cypher_q text;
-    where_clause text;
-    dst_label_id int;
-    dst_seq_fqn text;
-    dst_relation text;
-    inserted bigint;
-    has_rows boolean;
-BEGIN
-    -- Argument validation.
-    IF new_graph IS NULL THEN
-        RAISE EXCEPTION 'new graph name must not be NULL';
-    END IF;
-    IF from_graph IS NULL THEN
-        RAISE EXCEPTION 'source graph name must not be NULL';
-    END IF;
-    IF new_graph = from_graph THEN
-        RAISE EXCEPTION 'cannot extract a subgraph of "%" into itself', from_graph;
-    END IF;
-
-    -- NULL predicate is treated as the '*' wildcard (keep all).
-    IF node_filter IS NULL THEN
-        node_filter := '*';
-    END IF;
-    IF relationship_filter IS NULL THEN
-        relationship_filter := '*';
-    END IF;
-
-    -- The predicates are embedded into a dollar-quoted cypher() query using the
-    -- $age_subgraph$ tag; reject predicates that contain the tag to keep the
-    -- quoting unambiguous.
-    IF position('$age_subgraph$' IN node_filter) > 0
-       OR position('$age_subgraph$' IN relationship_filter) > 0 THEN
-        RAISE EXCEPTION 'filter predicate must not contain the reserved token $age_subgraph$';
-    END IF;
-
-    -- Validate source graph exists.
-    SELECT graphid INTO from_oid
-    FROM ag_catalog.ag_graph WHERE name = from_graph;
-    IF from_oid IS NULL THEN
-        RAISE EXCEPTION 'graph "%" does not exist', from_graph;
-    END IF;
-
-    -- Validate destination graph does not exist (create_graph also enforces
-    -- naming rules and uniqueness, but we give a clear early error).
-    IF EXISTS (SELECT 1 FROM ag_catalog.ag_graph WHERE name = new_graph) THEN
-        RAISE EXCEPTION 'graph "%" already exists', new_graph;
-    END IF;
-
-    -- Create the destination graph (default labels are created automatically).
-    PERFORM ag_catalog.create_graph(new_graph);
-
-    SELECT graphid INTO new_oid
-    FROM ag_catalog.ag_graph WHERE name = new_graph;
-
-    -- Working sets / mapping (uniquely named to avoid colliding with user temps).
-    DROP TABLE IF EXISTS _ag_sg_kept_v;
-    DROP TABLE IF EXISTS _ag_sg_kept_e;
-    DROP TABLE IF EXISTS _ag_sg_vmap;
-    DROP TABLE IF EXISTS _ag_sg_vstage;
-    DROP TABLE IF EXISTS _ag_sg_estage;
-
-    --
-    -- Kept vertices: evaluate node_filter with AGE's Cypher engine. The node
-    -- variable `n` is bound exactly as in the spec; '*' selects all vertices.
-    --
-    IF node_filter IS NULL OR btrim(node_filter) = '*' THEN
-        where_clause := '';
-    ELSE
-        where_clause := ' WHERE ' || node_filter;
-    END IF;
-    cypher_q := 'MATCH (n)' || where_clause || ' RETURN id(n)';
-
-    EXECUTE format(
-        'CREATE TEMP TABLE _ag_sg_kept_v ON COMMIT DROP AS '
-        'SELECT DISTINCT ag_catalog.agtype_to_graphid(vid) AS gid '
-        'FROM ag_catalog.cypher(%L, $age_subgraph$%s$age_subgraph$) AS (vid agtype)',
-        from_graph, cypher_q);
-    CREATE INDEX ON _ag_sg_kept_v (gid);
-
-    --
-    -- Kept edges: evaluate relationship_filter with AGE's Cypher engine. The
-    -- relationship variable `r` is bound exactly as in the spec.
-    --
-    IF relationship_filter IS NULL OR btrim(relationship_filter) = '*' THEN
-        where_clause := '';
-    ELSE
-        where_clause := ' WHERE ' || relationship_filter;
-    END IF;
-    cypher_q := 'MATCH ()-[r]->()' || where_clause || ' RETURN id(r)';
-
-    EXECUTE format(
-        'CREATE TEMP TABLE _ag_sg_kept_e ON COMMIT DROP AS '
-        'SELECT DISTINCT ag_catalog.agtype_to_graphid(eid) AS gid '
-        'FROM ag_catalog.cypher(%L, $age_subgraph$%s$age_subgraph$) AS (eid agtype)',
-        from_graph, cypher_q);
-    CREATE INDEX ON _ag_sg_kept_e (gid);
-
-    -- old -> new vertex id mapping (graphid is unique within a graph).
-    CREATE TEMP TABLE _ag_sg_vmap (old_id graphid PRIMARY KEY,
-                                   new_id graphid NOT NULL) ON COMMIT DROP;
-
-    --
-    -- PASS 1: copy kept vertices, label by label, assigning new graphids and
-    -- recording the old->new mapping for edge remapping.
-    --
-    FOR rec IN
-        SELECT name, id, relation, seq_name
-        FROM ag_catalog.ag_label
-        WHERE graph = from_oid AND kind = 'v'
-        ORDER BY id
-    LOOP
-        -- Skip labels with no surviving vertices. Read ONLY this label's own
-        -- rows: AGE label tables use table inheritance (custom labels inherit
-        -- from _ag_label_vertex), so a plain scan of a parent would also return
-        -- its children and copy them twice.
-        EXECUTE format(
-            'SELECT EXISTS (SELECT 1 FROM ONLY %s t '
-            'WHERE EXISTS (SELECT 1 FROM _ag_sg_kept_v k WHERE k.gid = t.id))',
-            rec.relation::regclass::text)
-        INTO has_rows;
-        IF NOT has_rows THEN
-            CONTINUE;
-        END IF;
-
-        -- Ensure the label exists in the destination graph.
-        IF rec.name <> '_ag_label_vertex' THEN
-            PERFORM 1 FROM ag_catalog.ag_label
-            WHERE graph = new_oid AND name = rec.name;
-            IF NOT FOUND THEN
-                EXECUTE format('SELECT ag_catalog.create_vlabel(%L, %L)',
-                               new_graph, rec.name);
-            END IF;
-        END IF;
-
-        SELECT id, seq_name, relation::regclass::text
-        INTO dst_label_id, dst_seq_fqn, dst_relation
-        FROM ag_catalog.ag_label
-        WHERE graph = new_oid AND name = rec.name;
-        dst_seq_fqn := format('%I.%I', new_graph, dst_seq_fqn);
-
-        -- Stage surviving vertices with freshly generated ids in a real temp
-        -- table (single evaluation), then copy to the label table and record
-        -- the old->new mapping. A materialized stage avoids any ambiguity from
-        -- referencing a nextval-bearing CTE more than once.
-        DROP TABLE IF EXISTS _ag_sg_vstage;
-        EXECUTE format(
-            'CREATE TEMP TABLE _ag_sg_vstage ON COMMIT DROP AS '
-            'SELECT t.id AS old_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)',
-            dst_label_id, dst_seq_fqn, rec.relation::regclass::text);
-
-        EXECUTE format('INSERT INTO %s (id, properties) '
-                       'SELECT new_id, props FROM _ag_sg_vstage', dst_relation);
-
-        INSERT INTO _ag_sg_vmap (old_id, new_id)
-            SELECT old_id, new_id FROM _ag_sg_vstage;
-
-        DROP TABLE _ag_sg_vstage;
-    END LOOP;
-
-    SELECT count(*) INTO v_node_count FROM _ag_sg_vmap;
-
-    --
-    -- PASS 2: copy kept edges, remapping endpoints. The joins to _ag_sg_vmap
-    -- enforce the induced rule (an edge survives only if BOTH endpoints were
-    -- kept); membership in _ag_sg_kept_e applies relationship_filter.
-    --
-    FOR rec IN
-        SELECT name, id, relation, seq_name
-        FROM ag_catalog.ag_label
-        WHERE graph = from_oid AND kind = 'e'
-        ORDER BY id
-    LOOP
-        -- Skip labels with no surviving edges. Read ONLY this label's own rows
-        -- (see the vertex pass for why inheritance requires ONLY).
-        EXECUTE format(
-            'SELECT EXISTS ('
-            '  SELECT 1 FROM ONLY %s x '
-            '  JOIN _ag_sg_vmap vs ON vs.old_id = x.start_id '
-            '  JOIN _ag_sg_vmap ve ON ve.old_id = x.end_id '
-            '  WHERE EXISTS (SELECT 1 FROM _ag_sg_kept_e k WHERE k.gid = x.id))',
-            rec.relation::regclass::text)
-        INTO has_rows;
-        IF NOT has_rows THEN
-            CONTINUE;
-        END IF;
-
-        IF rec.name <> '_ag_label_edge' THEN
-            PERFORM 1 FROM ag_catalog.ag_label
-            WHERE graph = new_oid AND name = rec.name;
-            IF NOT FOUND THEN
-                EXECUTE format('SELECT ag_catalog.create_elabel(%L, %L)',
-                               new_graph, rec.name);
-            END IF;
-        END IF;
-
-        SELECT id, seq_name, relation::regclass::text
-        INTO dst_label_id, dst_seq_fqn, dst_relation
-        FROM ag_catalog.ag_label
-        WHERE graph = new_oid AND name = rec.name;
-        dst_seq_fqn := format('%I.%I', new_graph, dst_seq_fqn);
-
-        -- Stage surviving edges, remapping endpoints through _ag_sg_vmap. The
-        -- joins enforce the induced rule (both endpoints kept); membership in
-        -- _ag_sg_kept_e applies relationship_filter.
-        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::regclass)) AS new_id, '
-            '       vs.new_id AS new_start, ve.new_id AS new_end, '
-            '       x.properties AS props '
-            'FROM ONLY %s x '
-            'JOIN _ag_sg_vmap vs ON vs.old_id = x.start_id '
-            'JOIN _ag_sg_vmap ve ON ve.old_id = x.end_id '
-            'WHERE EXISTS (SELECT 1 FROM _ag_sg_kept_e k WHERE k.gid = x.id)',
-            dst_label_id, dst_seq_fqn, rec.relation::regclass::text);
-
-        EXECUTE format('INSERT INTO %s (id, start_id, end_id, properties) '
-                       'SELECT new_id, new_start, new_end, props '
-                       'FROM _ag_sg_estage', dst_relation);
-        GET DIAGNOSTICS inserted = ROW_COUNT;
-        v_rel_count := v_rel_count + inserted;
-
-        DROP TABLE _ag_sg_estage;
-    END LOOP;
-
-    RETURN QUERY SELECT v_node_count, v_rel_count;
-END;
-$function$;
-
-COMMENT ON FUNCTION ag_catalog.create_subgraph(name, name, text, text) IS
-'Materializes a new persistent graph as the induced subgraph of from_graph selected by a Cypher node predicate (on n) and relationship predicate (on r); ''*'' keeps all. An edge is kept only if its predicate holds and both endpoints are kept. Returns (node_count, relationship_count).';
-
---
--- reduce(acc = init, var IN list | body) fold support
---
--- Transition function for the age_reduce aggregate. The fold body is compiled
--- by transform_cypher_reduce() with the accumulator and element rewritten to
--- PARAM_EXEC params 0 and 1 and serialized into the text argument; the
--- transition evaluates it for each element in list order. The trailing
--- agtype[] argument carries the loop-invariant outer values (outer-query
--- variables and cypher() parameters) referenced by the body, bound to
--- PARAM_EXEC params 2, 3, ... It must be callable with a NULL transition state
--- (no initcond), so it is intentionally not STRICT.
-CREATE FUNCTION ag_catalog.age_reduce_transfn(agtype, agtype, text, agtype, agtype[])
-    RETURNS agtype
-    LANGUAGE c
-PARALLEL UNSAFE
-AS 'MODULE_PATHNAME';
-
--- aggregate definition for reduce(); direct arguments are
--- (init, serialized-body, element, captured-outer-values), with the element
--- fed ORDER BY ordinality.
-CREATE AGGREGATE ag_catalog.age_reduce(agtype, text, agtype, agtype[])
-(
-    stype = agtype,
-    sfunc = ag_catalog.age_reduce_transfn
-);
diff --git a/age--1.8.0--y.y.y.sql b/age--1.6.0--y.y.y.sql
similarity index 93%
rename from age--1.8.0--y.y.y.sql
rename to age--1.6.0--y.y.y.sql
index 4c85b28c..d781be98 100644
--- a/age--1.8.0--y.y.y.sql
+++ b/age--1.6.0--y.y.y.sql
@@ -17,9 +17,6 @@
  * under the License.
  */
 
--- This will only work within a major version of PostgreSQL, not across
--- major versions.
-
 --* This is a TEMPLATE for upgrading from the previous version of Apache AGE
 --* Please adjust the below ALTER EXTENSION to reflect the -- correct version it
 --* is upgrading to.
@@ -33,3 +30,4 @@
 --* Please add all additions, deletions, and modifications to the end of this
 --* file. We need to keep the order of these changes.
 --* REMOVE ALL LINES ABOVE, and this one, that start with --*
+
diff --git a/age.control b/age.control
index 8b1d3aef..8bd40360 100644
--- a/age.control
+++ b/age.control
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-default_version = '1.8.0'
+default_version = '1.6.0'
 comment = 'AGE database extension'
 module_pathname = '$libdir/age'
 
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 8fbd69a0..94bf98eb 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -49,7 +49,7 @@ ENV LC_COLLATE=en_US.UTF-8
 ENV LC_CTYPE=en_US.UTF-8
 
 COPY --from=build /usr/lib/postgresql/15/lib/age.so /usr/lib/postgresql/15/lib/
-COPY --from=build /usr/share/postgresql/15/extension/age--*.sql /usr/share/postgresql/15/extension/
+COPY --from=build /usr/share/postgresql/15/extension/age--1.6.0.sql /usr/share/postgresql/15/extension/
 COPY --from=build /usr/share/postgresql/15/extension/age.control /usr/share/postgresql/15/extension/
 COPY docker/docker-entrypoint-initdb.d/00-create-extension-age.sql /docker-entrypoint-initdb.d/00-create-extension-age.sql
 
diff --git a/drivers/golang/go.mod b/drivers/golang/go.mod
index e212c432..95628d9f 100644
--- a/drivers/golang/go.mod
+++ b/drivers/golang/go.mod
@@ -31,5 +31,5 @@ require (
 	github.com/davecgh/go-spew v1.1.0 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
 	golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect
-	gopkg.in/yaml.v3 v3.0.1 // indirect
+	gopkg.in/yaml.v3 v3.0.0 // indirect
 )
diff --git a/drivers/golang/go.sum b/drivers/golang/go.sum
index eba2fed1..26bb0f3b 100644
--- a/drivers/golang/go.sum
+++ b/drivers/golang/go.sum
@@ -2,6 +2,8 @@ github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1 h
 github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
 github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
+github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
 github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -9,10 +11,14 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
+golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
+golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
+golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
 golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo=
 golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
-gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
+gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/drivers/jdbc/lib/build.gradle.kts b/drivers/jdbc/lib/build.gradle.kts
index 4965c2a5..0b63bc5a 100644
--- a/drivers/jdbc/lib/build.gradle.kts
+++ b/drivers/jdbc/lib/build.gradle.kts
@@ -38,17 +38,13 @@ dependencies {
     testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
     testRuntimeOnly("org.junit.platform:junit-platform-launcher")
 
-    testImplementation("org.testcontainers:testcontainers:1.21.4")
+    testImplementation("org.testcontainers:testcontainers:1.18.0")
     testImplementation("org.postgresql:postgresql:42.6.0")
 
     testImplementation("org.slf4j:slf4j-api:2.0.7")
     testImplementation("org.slf4j:slf4j-simple:2.0.7")
 }
 
-tasks.withType<JavaCompile> {
-    options.encoding = "UTF-8"
-}
-
 tasks.generateGrammarSource {
     maxHeapSize = "64m"
     source = project.objects
diff --git a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
index 201e4034..8e9c705a 100644
--- a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
+++ b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
@@ -21,7 +21,6 @@ package org.apache.age.jdbc;
 
 import java.sql.DriverManager;
 import java.sql.Statement;
-import java.time.Duration;
 import org.apache.age.jdbc.base.Agtype;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
@@ -29,7 +28,6 @@ import org.junit.jupiter.api.TestInstance;
 import org.junit.jupiter.api.TestInstance.Lifecycle;
 import org.postgresql.jdbc.PgConnection;
 import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
 import org.testcontainers.utility.DockerImageName;
 
 @TestInstance(Lifecycle.PER_CLASS)
@@ -56,19 +54,20 @@ public class BaseDockerizedTest {
         agensGraphContainer = new GenericContainer<>(DockerImageName
             .parse("apache/age:dev_snapshot_PG15"))
             .withEnv("POSTGRES_PASSWORD", CORRECT_DB_PASSWORDS)
-            .withExposedPorts(5432)
-            .waitingFor(Wait.forLogMessage(".*database system is ready to accept connections.*\\n", 2)
-                .withStartupTimeout(Duration.ofSeconds(60)));
+            .withExposedPorts(5432);
         agensGraphContainer.start();
 
-        String host = agensGraphContainer.getHost();
         int mappedPort = agensGraphContainer.getMappedPort(5432);
         String jdbcUrl = String
-            .format("jdbc:postgresql://%s:%d/%s?sslmode=disable", host, mappedPort, "postgres");
+            .format("jdbc:postgresql://%s:%d/%s", "localhost", mappedPort, "postgres");
 
-        this.connection = DriverManager.getConnection(jdbcUrl, "postgres", CORRECT_DB_PASSWORDS)
-                     .unwrap(PgConnection.class);
-        this.connection.addDataType("agtype", Agtype.class);
+        try {
+            this.connection = DriverManager.getConnection(jdbcUrl, "postgres", CORRECT_DB_PASSWORDS)
+                         .unwrap(PgConnection.class);
+            this.connection.addDataType("agtype", Agtype.class);
+        } catch (Exception e) {
+            System.out.println(e);
+        }
         try (Statement statement = connection.createStatement()) {
             statement.execute("CREATE EXTENSION IF NOT EXISTS age;");
             statement.execute("LOAD 'age'");
diff --git a/drivers/nodejs/package.json b/drivers/nodejs/package.json
index d17aa3b3..9f88bc2b 100644
--- a/drivers/nodejs/package.json
+++ b/drivers/nodejs/package.json
@@ -30,11 +30,10 @@
   "author": "Alex Kwak <ta...@kakao.com>",
   "dependencies": {
     "antlr4ts": "^0.5.0-alpha.4",
-    "pg": ">=8.0.0"
+    "pg": ">=6.0.0"
   },
   "devDependencies": {
-    "@types/jest": "^29.5.14",
-    "@types/node": "^20.19.0",
+    "@types/jest": "^26.0.20",
     "@types/pg": "^7.14.10",
     "@typescript-eslint/eslint-plugin": "^4.22.1",
     "@typescript-eslint/parser": "^4.22.1",
@@ -45,8 +44,8 @@
     "eslint-plugin-jest": "^24.3.6",
     "eslint-plugin-node": "^11.1.0",
     "eslint-plugin-promise": "^4.3.1",
-    "jest": "^29.7.0",
-    "ts-jest": "^29.4.6",
-    "typescript": "^4.9.5"
+    "jest": "^26.6.3",
+    "ts-jest": "^26.5.1",
+    "typescript": "^4.1.5"
   }
 }
diff --git a/drivers/nodejs/src/antlr4/CustomAgTypeListener.ts b/drivers/nodejs/src/antlr4/CustomAgTypeListener.ts
index 6089ee99..fceabee2 100644
--- a/drivers/nodejs/src/antlr4/CustomAgTypeListener.ts
+++ b/drivers/nodejs/src/antlr4/CustomAgTypeListener.ts
@@ -92,11 +92,7 @@ class CustomAgTypeListener implements AgtypeListener, ParseTreeListener {
   }
 
   exitIntegerValue (ctx: IntegerValueContext): void {
-    // Use BigInt for values that exceed Number.MAX_SAFE_INTEGER to
-    // prevent silent precision loss with large AGE graph IDs (64-bit).
-    const text = ctx.text
-    const num = Number(text)
-    const value = Number.isSafeInteger(num) ? num : BigInt(text)
+    const value = parseInt(ctx.text)
     if (!this.pushIfArray(value)) {
       this.lastValue = value
     }
diff --git a/drivers/nodejs/src/index.ts b/drivers/nodejs/src/index.ts
index dad004a8..416cc3da 100644
--- a/drivers/nodejs/src/index.ts
+++ b/drivers/nodejs/src/index.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import { Client, QueryResult, QueryResultRow } from 'pg'
+import { Client } from 'pg'
 import pgTypes from 'pg-types'
 import { CharStreams, CommonTokenStream } from 'antlr4ts'
 import { AgtypeLexer } from './antlr4/AgtypeLexer'
@@ -25,122 +25,6 @@ import { AgtypeParser } from './antlr4/AgtypeParser'
 import CustomAgTypeListener from './antlr4/CustomAgTypeListener'
 import { ParseTreeWalker } from 'antlr4ts/tree'
 
-/**
- * Valid graph name pattern based on Apache AGE's naming conventions
- * (Neo4j/openCypher compatible). Allows ASCII letters, digits,
- * underscores, plus dots and hyphens in middle positions.
- *
- * DESIGN NOTE: AGE's server-side validation (name_validation.h) uses
- * full Unicode ID_Start/ID_Continue character classes, accepting names
- * like 'mydätabase' or 'mydঅtabase'. This driver intentionally restricts
- * to ASCII-only as a security hardening measure — it reduces the attack
- * surface for homoglyph and encoding-based injection vectors. Server-side
- * validation remains the authoritative check for Unicode names.
- *
- * Start: ASCII letter or underscore
- * Middle: ASCII letter, digit, underscore, dot, or hyphen
- * End: ASCII letter, digit, or underscore
- */
-const VALID_GRAPH_NAME = /^[A-Za-z_][A-Za-z0-9_.\-]*[A-Za-z0-9_]$/
-
-/**
- * Valid label name pattern based on Apache AGE's naming rules.
- * Labels follow stricter identifier rules than graph names — dots and
- * hyphens are NOT permitted in label names.
- *
- * Note: ASCII-only restriction (see VALID_GRAPH_NAME design note above).
- */
-const VALID_LABEL_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/
-
-/**
- * Valid SQL identifier pattern for column names and types in the
- * query result AS clause. Standard PostgreSQL unquoted identifier rules.
- *
- * Note: ASCII-only restriction (see VALID_GRAPH_NAME design note above).
- */
-const VALID_SQL_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/
-
-/**
- * Validates that a graph name conforms to Apache AGE's naming conventions
- * and is safe for use in SQL queries.
- *
- * Graph names must:
- * - Be at least 3 characters and at most 63 characters
- * - Start with an ASCII letter or underscore
- * - Contain only ASCII letters, digits, underscores, dots, and hyphens
- * - End with an ASCII letter, digit, or underscore
- *
- * Note: This is intentionally stricter than AGE's server-side validation
- * (which accepts Unicode letters). See VALID_GRAPH_NAME design note.
- *
- * @param graphName - The graph name to validate
- * @throws Error if the graph name is invalid
- */
-function validateGraphName (graphName: string): void {
-  if (!graphName || typeof graphName !== 'string') {
-    throw new Error('Graph name must be a non-empty string')
-  }
-  if (graphName.length < 3) {
-    throw new Error(
-      `Invalid graph name: '${graphName}'. Graph names must be at least 3 characters.`
-    )
-  }
-  if (graphName.length > 63) {
-    throw new Error('Graph name must not exceed 63 characters (PostgreSQL name limit)')
-  }
-  if (!VALID_GRAPH_NAME.test(graphName)) {
-    throw new Error(
-      `Invalid graph name: '${graphName}'. Graph names must start with a letter ` +
-      'or underscore, may contain letters, digits, underscores, dots, and hyphens, ' +
-      'and must end with a letter, digit, or underscore.'
-    )
-  }
-}
-
-/**
- * Validates that a label name conforms to Apache AGE's naming rules.
- * Label names are stricter than graph names — only letters, digits,
- * and underscores are permitted (no dots or hyphens).
- *
- * @param labelName - The label name to validate
- * @throws Error if the label name is invalid
- */
-function validateLabelName (labelName: string): void {
-  if (!labelName || typeof labelName !== 'string') {
-    throw new Error('Label name must be a non-empty string')
-  }
-  if (labelName.length > 63) {
-    throw new Error('Label name must not exceed 63 characters (PostgreSQL name limit)')
-  }
-  if (!VALID_LABEL_NAME.test(labelName)) {
-    throw new Error(
-      `Invalid label name: '${labelName}'. Label names must start with a letter ` +
-      'or underscore and contain only letters, digits, and underscores.'
-    )
-  }
-}
-
-/**
- * Escapes a PostgreSQL dollar-quoted string literal by ensuring the
- * cypher query does not contain the dollar-quote delimiter. If the
- * default $$ delimiter conflicts, a unique tagged delimiter is used.
- *
- * @param cypher - The Cypher query string
- * @returns An object with the delimiter and safely quoted string
- */
-function cypherDollarQuote (cypher: string): { delimiter: string; quoted: string } {
-  if (!cypher.includes('$$')) {
-    return { delimiter: '$$', quoted: `$$${cypher}$$` }
-  }
-  // Generate a unique tag that doesn't appear in the cypher query
-  let tag = 'cypher'
-  let counter = 0
-  while (cypher.includes(`$${tag}$`)) {
-    tag = `cypher${counter++}`
-  }
-  return { delimiter: `$${tag}$`, quoted: `$${tag}$${cypher}$${tag}$` }
-}
-
 function AGTypeParse (input: string) {
   const chars = CharStreams.fromString(input)
   const lexer = new AgtypeLexer(chars)
@@ -152,180 +36,21 @@ function AGTypeParse (input: string) {
   return printer.getResult()
 }
 
-/**
- * Options for setAGETypes configuration.
- */
-interface SetAGETypesOptions {
-  /**
-   * If true, will attempt to CREATE EXTENSION IF NOT EXISTS age.
-   * Defaults to false. Set to true only if the connected user has
-   * sufficient privileges.
-   */
-  createExtension?: boolean
-}
-
-/**
- * Configures the pg client to properly parse AGE agtype results.
- *
- * This function:
- * 1. Loads the AGE extension into the session
- * 2. Sets the search_path to include ag_catalog
- * 3. Registers the agtype type parser
- *
- * @param client - A connected pg Client instance
- * @param types - The pg types module for registering type parsers
- * @param options - Optional configuration settings
- * @throws Error if AGE extension is not installed or agtype is not found
- */
-async function setAGETypes (client: Client, types: typeof pgTypes, options?: SetAGETypesOptions) {
-  const createExtension = options?.createExtension ?? false
-
-  if (createExtension) {
-    await client.query('CREATE EXTENSION IF NOT EXISTS age;')
-  }
-
-  try {
-    await client.query("LOAD 'age';")
-    await client.query('SET search_path = ag_catalog, "$user", public;')
-  } catch (err: unknown) {
-    const msg = err instanceof Error ? err.message : String(err)
-    throw new Error(
-      `Failed to load AGE extension: ${msg}. ` +
-      'Ensure the AGE extension is installed in the database. ' +
-      'You may need to run CREATE EXTENSION age; first, or pass ' +
-      '{ createExtension: true } to setAGETypes().'
-    )
-  }
+async function setAGETypes (client: Client, types: typeof pgTypes) {
+  await client.query(`
+        CREATE EXTENSION IF NOT EXISTS age;
+        LOAD 'age';
+        SET search_path = ag_catalog, "$user", public;
+    `)
 
-  const oidResults = await client.query(
-    "SELECT typelem FROM pg_type WHERE typname = '_agtype';"
-  )
+  const oidResults = await client.query(`
+        select typelem
+        from pg_type
+        where typname = '_agtype';`)
 
-  if (oidResults.rows.length < 1) {
-    throw new Error(
-      'AGE agtype type not found. Ensure the AGE extension is installed ' +
-      'and loaded in the current database. Run CREATE EXTENSION age; first, ' +
-      'or pass { createExtension: true } to setAGETypes().'
-    )
-  }
+  if (oidResults.rows.length < 1) { throw new Error() }
 
   types.setTypeParser(oidResults.rows[0].typelem, AGTypeParse)
 }
 
-/**
- * Column definition for Cypher query results.
- */
-interface CypherColumn {
-  /** Column alias name */
-  name: string
-  /** Column type (defaults to 'agtype') */
-  type?: string
-}
-
-/**
- * Executes a Cypher query safely against an AGE graph.
- *
- * This function validates the graph name to prevent SQL injection,
- * properly quotes the Cypher query using dollar-quoting, and builds
- * the required SQL wrapper.
- *
- * @param client - A connected pg Client instance (with AGE types set)
- * @param graphName - The target graph name (must be a valid AGE graph name)
- * @param cypher - The Cypher query string
- * @param columns - Column definitions for the result set
- * @returns The query result
- * @throws Error if graphName is invalid or query fails
- *
- * @example
- * ```typescript
- * const result = await queryCypher(
- *   client,
- *   'my_graph',
- *   'MATCH (n:Person) WHERE n.name = $name RETURN n',
- *   [{ name: 'n' }]
- * );
- * ```
- */
-async function queryCypher<T extends QueryResultRow = any> (
-  client: Client,
-  graphName: string,
-  cypher: string,
-  columns: CypherColumn[] = [{ name: 'result' }]
-): Promise<QueryResult<T>> {
-  // Validate graph name against injection
-  validateGraphName(graphName)
-
-  // Validate column definitions
-  if (!columns || columns.length === 0) {
-    throw new Error('At least one column definition is required')
-  }
-
-  for (const col of columns) {
-    if (!col.name || typeof col.name !== 'string') {
-      throw new Error('Column name must be a non-empty string')
-    }
-    // Column names must be valid SQL identifiers
-    if (!VALID_SQL_IDENTIFIER.test(col.name)) {
-      throw new Error(
-        `Invalid column name: '${col.name}'. Column names must be valid SQL identifiers.`
-      )
-    }
-    if (col.type && !VALID_SQL_IDENTIFIER.test(col.type)) {
-      throw new Error(
-        `Invalid column type: '${col.type}'. Column types must be valid SQL type identifiers.`
-      )
-    }
-  }
-
-  // Build column list safely
-  const columnList = columns
-    .map(col => `${col.name} ${col.type ?? 'agtype'}`)
-    .join(', ')
-
-  // Safely dollar-quote the cypher query
-  const { quoted } = cypherDollarQuote(cypher)
-
-  const sql = `SELECT * FROM cypher('${graphName}', ${quoted}) AS (${columnList});`
-
-  return client.query<T>(sql)
-}
-
-/**
- * Creates a new graph safely.
- *
- * @param client - A connected pg Client instance
- * @param graphName - Name for the new graph (must be a valid AGE graph name)
- * @throws Error if graphName is invalid
- */
-async function createGraph (client: Client, graphName: string): Promise<void> {
-  validateGraphName(graphName)
-  await client.query(`SELECT * FROM ag_catalog.create_graph('${graphName}');`)
-}
-
-/**
- * Drops an existing graph safely.
- *
- * @param client - A connected pg Client instance
- * @param graphName - Name of the graph to drop (must be a valid AGE graph name)
- * @param cascade - If true, drop dependent objects (default: false)
- * @throws Error if graphName is invalid
- */
-async function dropGraph (client: Client, graphName: string, cascade: boolean = false): Promise<void> {
-  validateGraphName(graphName)
-  if (typeof cascade !== 'boolean') {
-    throw new Error('cascade parameter must be a boolean')
-  }
-  await client.query(`SELECT * FROM ag_catalog.drop_graph('${graphName}', ${cascade});`)
-}
-
-export {
-  setAGETypes,
-  AGTypeParse,
-  queryCypher,
-  createGraph,
-  dropGraph,
-  validateGraphName,
-  validateLabelName,
-  SetAGETypesOptions,
-  CypherColumn
-}
+export { setAGETypes, AGTypeParse }
diff --git a/drivers/nodejs/test/Agtype.test.ts b/drivers/nodejs/test/Agtype.test.ts
index f1b1463a..5ae26b54 100644
--- a/drivers/nodejs/test/Agtype.test.ts
+++ b/drivers/nodejs/test/Agtype.test.ts
@@ -101,31 +101,4 @@ describe('Parsing', () => {
       }))
     })))
   })
-
-  it('Large integer uses BigInt when exceeding MAX_SAFE_INTEGER', () => {
-    // 2^53 = 9007199254740992 exceeds MAX_SAFE_INTEGER (2^53 - 1)
-    const result = AGTypeParse('{"id": 9007199254740993, "label": "test", "properties": {}}::vertex')
-    const id = (result as Map<string, any>).get('id')
-    expect(typeof id).toBe('bigint')
-    expect(id).toBe(BigInt('9007199254740993'))
-  })
-
-  it('Safe integers remain as Number type', () => {
-    const result = AGTypeParse('{"id": 844424930131969, "label": "test", "properties": {}}::vertex')
-    const id = (result as Map<string, any>).get('id')
-    expect(typeof id).toBe('number')
-    expect(id).toBe(844424930131969)
-  })
-
-  it('Small integers remain as Number type', () => {
-    const result = AGTypeParse('42')
-    expect(typeof result).toBe('number')
-    expect(result).toBe(42)
-  })
-
-  it('Negative integers parsed correctly', () => {
-    const result = AGTypeParse('-100')
-    expect(typeof result).toBe('number')
-    expect(result).toBe(-100)
-  })
 })
diff --git a/drivers/nodejs/test/index.test.ts b/drivers/nodejs/test/index.test.ts
index ae2c5c31..ea386dda 100644
--- a/drivers/nodejs/test/index.test.ts
+++ b/drivers/nodejs/test/index.test.ts
@@ -17,33 +17,18 @@
  * under the License.
  */
 
-import { types, Client } from 'pg'
-import {
-  setAGETypes,
-  queryCypher,
-  createGraph,
-  dropGraph,
-  validateGraphName,
-  validateLabelName
-} from '../src'
+import { types, Client, QueryResultRow } from 'pg'
+import { setAGETypes } from '../src'
 
 const config = {
-  user: process.env.PGUSER || 'postgres',
-  password: process.env.PGPASSWORD || 'agens',
-  host: process.env.PGHOST || '127.0.0.1',
-  database: process.env.PGDATABASE || 'postgres',
-  port: parseInt(process.env.PGPORT || '5432', 10)
+  user: 'postgres',
+  host: '127.0.0.1',
+  database: 'postgres',
+  password: 'agens',
+  port: 5432
 }
 
-const testGraphName = 'age_test'
-
-// DESIGN NOTE: All test suites use { createExtension: false } intentionally.
-// The CI Docker image (apache/age:dev_snapshot_master) has the AGE extension
-// pre-installed, matching the GitHub Actions workflow. Using createExtension: false
-// is the correct security default — auto-creating extensions requires SUPERUSER
-// privileges and conflates extension lifecycle management with session setup.
-// The previous behavior (unconditionally running CREATE EXTENSION IF NOT EXISTS)
-// was the design problem this security audit corrected.
+const testGraphName = 'age-test'
 
 describe('Pre-connected Connection', () => {
   let client: Client | null
@@ -51,203 +36,67 @@ describe('Pre-connected Connection', () => {
   beforeAll(async () => {
     client = new Client(config)
     await client.connect()
-    await setAGETypes(client, types, { createExtension: false })
-    await createGraph(client, testGraphName)
+    await setAGETypes(client, types)
+    await client.query(`SELECT create_graph('${testGraphName}');`)
   })
   afterAll(async () => {
-    if (client) {
-      await dropGraph(client, testGraphName, true)
-      await client.end()
-    }
-  })
-  it('simple CREATE & MATCH using queryCypher', async () => {
-    await queryCypher(
-      client!,
-      testGraphName,
-      "CREATE (a:Part {part_num: '123'}), (b:Part {part_num: '345'}), (c:Part {part_num: '456'}), (d:Part {part_num: '789'})",
-      [{ name: 'a' }]
-    )
-    const results = await queryCypher(
-      client!,
-      testGraphName,
-      'MATCH (a) RETURN a',
-      [{ name: 'a' }]
+    await client?.query(`SELECT drop_graph('${testGraphName}', true);`)
+    await client?.end()
+  })
+  it('simple CREATE & MATCH', async () => {
+    await client?.query(`
+            SELECT *
+            from cypher('${testGraphName}', $$ CREATE (a:Part {part_num: '123'}),
+                        (b:Part {part_num: '345'}),
+                        (c:Part {part_num: '456'}),
+                        (d:Part {part_num: '789'})
+                            $$) as (a agtype);
+        `)
+    const results: QueryResultRow = await client?.query<QueryResultRow>(`
+            SELECT *
+            from cypher('${testGraphName}', $$
+                MATCH (a) RETURN a
+            $$) as (a agtype);
+        `)!
+    expect(results.rows).toStrictEqual(
+      [
+        {
+          a : new Map(Object.entries({
+            id: 844424930131969,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '123'
+            }))
+          })),
+        },
+        {
+          a : new Map(Object.entries({
+            id: 844424930131970,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '345'
+            }))
+          })),
+        },
+        {
+          a : new Map(Object.entries({
+            id: 844424930131971,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '456'
+            }))
+          })),
+        },
+        {
+          a : new Map(Object.entries({
+            id: 844424930131972,
+            label: 'Part',
+            properties: new Map(Object.entries({
+              part_num: '789'
+            }))
+          })),
+        }
+      ]
     )
-    expect(results.rows.length).toBe(4)
-    // Verify node properties are preserved
-    const partNums = results.rows.map((row: any) => row.a.get('properties').get('part_num'))
-    expect(partNums).toContain('123')
-    expect(partNums).toContain('345')
-    expect(partNums).toContain('456')
-    expect(partNums).toContain('789')
-  })
-})
-
-describe('Graph Name Validation', () => {
-  it('rejects empty graph name', () => {
-    expect(() => validateGraphName('')).toThrow('non-empty string')
-  })
-
-  it('rejects null/undefined graph name', () => {
-    expect(() => validateGraphName(null as any)).toThrow('non-empty string')
-    expect(() => validateGraphName(undefined as any)).toThrow('non-empty string')
-  })
-
-  it('rejects graph names shorter than 3 characters', () => {
-    expect(() => validateGraphName('ab')).toThrow('at least 3 characters')
-    expect(() => validateGraphName('a')).toThrow('at least 3 characters')
-  })
-
-  it('rejects graph names exceeding 63 characters', () => {
-    const longName = 'a'.repeat(64)
-    expect(() => validateGraphName(longName)).toThrow('63 characters')
-  })
-
-  it('rejects graph names starting with digits', () => {
-    expect(() => validateGraphName('123graph')).toThrow('Invalid graph name')
-  })
-
-  it('rejects graph names with SQL injection attempts', () => {
-    expect(() => validateGraphName("'; DROP TABLE ag_graph; --")).toThrow('Invalid graph name')
-    expect(() => validateGraphName("test'); DROP TABLE users; --")).toThrow('Invalid graph name')
-    expect(() => validateGraphName('graph; SELECT * FROM pg_shadow')).toThrow('Invalid graph name')
-  })
-
-  it('rejects graph names with disallowed characters', () => {
-    expect(() => validateGraphName('my graph')).toThrow('Invalid graph name')
-    expect(() => validateGraphName('my$graph')).toThrow('Invalid graph name')
-    expect(() => validateGraphName("my'graph")).toThrow('Invalid graph name')
-    expect(() => validateGraphName('my@graph')).toThrow('Invalid graph name')
-  })
-
-  it('rejects graph names ending with dot or hyphen', () => {
-    expect(() => validateGraphName('graph-')).toThrow('Invalid graph name')
-    expect(() => validateGraphName('graph.')).toThrow('Invalid graph name')
-  })
-
-  it('accepts graph names with hyphens (Neo4j/openCypher compatible)', () => {
-    expect(() => validateGraphName('my-graph')).not.toThrow()
-    expect(() => validateGraphName('age-test')).not.toThrow()
-    expect(() => validateGraphName('my-multi-part-name')).not.toThrow()
-  })
-
-  it('accepts graph names with dots', () => {
-    expect(() => validateGraphName('my.graph')).not.toThrow()
-    expect(() => validateGraphName('tenant.db')).not.toThrow()
-  })
-
-  it('accepts standard identifier graph names', () => {
-    expect(() => validateGraphName('my_graph')).not.toThrow()
-    expect(() => validateGraphName('MyGraph')).not.toThrow()
-    expect(() => validateGraphName('_private')).not.toThrow()
-    expect(() => validateGraphName('graph123')).not.toThrow()
-    expect(() => validateGraphName('abc')).not.toThrow()
-  })
-})
-
-describe('Label Name Validation', () => {
-  it('rejects SQL injection in label names', () => {
-    expect(() => validateLabelName("Person'; DROP TABLE--")).toThrow('Invalid label name')
-  })
-
-  it('rejects label names with hyphens and dots (per AGE rules)', () => {
-    expect(() => validateLabelName('Has-Relationship')).toThrow('Invalid label name')
-    expect(() => validateLabelName('label.name')).toThrow('Invalid label name')
-  })
-
-  it('accepts valid label names', () => {
-    expect(() => validateLabelName('Person')).not.toThrow()
-    expect(() => validateLabelName('KNOWS')).not.toThrow()
-    expect(() => validateLabelName('_internal')).not.toThrow()
-    expect(() => validateLabelName('Label123')).not.toThrow()
-  })
-})
-
-describe('SQL Injection Prevention', () => {
-  let client: Client
-
-  beforeAll(async () => {
-    client = new Client(config)
-    await client.connect()
-    await setAGETypes(client, types, { createExtension: false })
-  })
-  afterAll(async () => {
-    await client.end()
-  })
-
-  it('queryCypher rejects injected graph name', async () => {
-    await expect(
-      queryCypher(client, "test'); DROP TABLE ag_graph;--", 'MATCH (n) RETURN n', [{ name: 'n' }])
-    ).rejects.toThrow('Invalid graph name')
-  })
-
-  it('queryCypher rejects injected column name', async () => {
-    await expect(
-      queryCypher(client, 'age_test', 'MATCH (n) RETURN n', [{ name: "n); DROP TABLE ag_graph;--" }])
-    ).rejects.toThrow('Invalid column name')
-  })
-
-  it('createGraph rejects injected graph name', async () => {
-    await expect(
-      createGraph(client, "test'); DROP TABLE ag_graph;--")
-    ).rejects.toThrow('Invalid graph name')
-  })
-
-  it('dropGraph rejects injected graph name', async () => {
-    await expect(
-      dropGraph(client, "test'); DROP TABLE ag_graph;--")
-    ).rejects.toThrow('Invalid graph name')
-  })
-
-  it('dropGraph rejects non-boolean cascade from JS', async () => {
-    await expect(
-      dropGraph(client, 'age_test', 'true; DROP TABLE ag_graph;--' as any)
-    ).rejects.toThrow('cascade parameter must be a boolean')
-  })
-})
-
-describe('Hyphenated Graph Name (Neo4j/openCypher compatible)', () => {
-  const hyphenatedGraphName = 'age-test'
-  let client: Client | null
-
-  beforeAll(async () => {
-    client = new Client(config)
-    await client.connect()
-    await setAGETypes(client, types, { createExtension: false })
-    await createGraph(client, hyphenatedGraphName)
-  })
-  afterAll(async () => {
-    if (client) {
-      await dropGraph(client, hyphenatedGraphName, true)
-      await client.end()
-    }
-  })
-
-  it('creates and queries a graph with hyphens in the name', async () => {
-    await queryCypher(
-      client!,
-      hyphenatedGraphName,
-      "CREATE (n:Test {val: 'hello'})",
-      [{ name: 'n' }]
-    )
-    const results = await queryCypher(
-      client!,
-      hyphenatedGraphName,
-      'MATCH (n:Test) RETURN n',
-      [{ name: 'n' }]
-    )
-    expect(results.rows.length).toBe(1)
-  })
-})
-
-describe('setAGETypes error handling', () => {
-  it('throws when client connection has been closed', async () => {
-    const tempClient = new Client(config)
-    await tempClient.connect()
-    await tempClient.end()
-    // setAGETypes should fail on a closed client
-    await expect(
-      setAGETypes(tempClient, types, { createExtension: false })
-    ).rejects.toThrow()
   })
 })
diff --git a/drivers/python/README.md b/drivers/python/README.md
index ae61ab4a..c895fe76 100644
--- a/drivers/python/README.md
+++ b/drivers/python/README.md
@@ -28,11 +28,11 @@ AGType parser and driver support for [Apache AGE](https://age.apache.org/), grap
 
 ### Features
 * Unmarshal AGE result data(AGType) to Vertex, Edge, Path
-* Cypher query support for Psycopg3 PostgreSQL driver (enables to use cypher queries directly)
+* Cypher query support for Psycopg2 PostgreSQL driver (enables to use cypher queries directly)
 
 ### Prerequisites
 * over Python 3.9
-* This module runs on [psycopg3](https://www.psycopg.org/) and [antlr4-python3](https://pypi.org/project/antlr4-python3-runtime/)
+* This module runs on [psycopg2](https://www.psycopg.org/) and [antlr4-python3](https://pypi.org/project/antlr4-python3-runtime/)
 ```
 sudo apt-get update
 sudo apt-get install python3-dev libpq-dev
@@ -62,7 +62,7 @@ python -m unittest -v test_agtypes.py
 
 ### Build from source
 ```
-pip install .
+python setup.py install
 ```
 
 ### For more information about [Apache AGE](https://age.apache.org/)
@@ -80,7 +80,7 @@ SET search_path = ag_catalog, "$user", public;
 ```
 
 ### Usage
-* If you are not familiar with Psycopg driver : Go to [Jupyter Notebook : Basic Sample](samples/apache-age-basic.ipynb) 
+* If you are familiar with Psycopg2 driver : Go to [Jupyter Notebook : Basic Sample](samples/apache-age-basic.ipynb) 
 * Simpler way to access Apache AGE [AGE Sample](samples/apache-age-note.ipynb) in Samples.
 * Agtype converting samples: [Agtype Sample](samples/apache-age-agtypes.ipynb) in Samples.
 
@@ -89,25 +89,9 @@ SET search_path = ag_catalog, "$user", public;
 * Make sure to give your non-superuser db account proper permissions to the graph schemas and corresponding objects
 * Make sure to initiate the Apache Age python driver with the ```load_from_plugins``` parameter. This parameter tries to
   load the Apache Age extension from the PostgreSQL plugins directory located at ```$libdir/plugins/age```. Example:
-  ```python
+  ```python.
   ag = age.connect(host='localhost', port=5432, user='dbuser', password='strong_password', 
-                   dbname='postgres', load_from_plugins=True, graph='graph_name')
-  ```
-
-### Managed PostgreSQL Usage (Azure, AWS RDS, etc.)
-* On managed PostgreSQL services where the AGE extension is loaded server-side via ```shared_preload_libraries```,
-  the ```LOAD 'age'``` command may fail because the binary is not at the expected file path. Use the ```skip_load```
-  parameter to skip the ```LOAD``` statement while still performing all other setup:
-  ```python
-  ag = age.connect(host='myserver.postgres.database.azure.com', port=5432,
-                   user='dbuser', password='strong_password',
-                   dbname='postgres', skip_load=True, graph='graph_name')
-  ```
-* **Connection pools:** If you manage connections externally (e.g. via ```psycopg_pool.ConnectionPool```),
-  you can call ```setUpAge()``` with ```skip_load=True``` on each pooled connection:
-  ```python
-  from age.age import setUpAge
-  setUpAge(conn, 'graph_name', skip_load=True)
+                   dbname=postgres, load_from_plugins=True, graph='graph_name)
   ```
 
 ### License
@@ -135,7 +119,7 @@ Here the following value required
 Insert From networkx directed graph into an Age database.
 #### Parameters
 
-- `connection` (psycopg.connect): Connection object to the AGE database.
+- `connection` (psycopg2.connect): Connection object to the Age database.
 
 - `G` (networkx.DiGraph): Networkx directed graph to be converted and inserted.
 
@@ -168,7 +152,7 @@ Converts data from a Apache AGE graph database into a Networkx directed graph.
 
 #### Parameters
 
-- `connection` (psycopg.connect): Connection object to the PostgreSQL database.
+- `connection` (psycopg2.connect): Connection object to the PostgreSQL database.
 - `graphName` (str): Name of the graph.
 - `G` (None | nx.DiGraph): Optional Networkx directed graph. If provided, the data will be added to this graph.
 - `query` (str | None): Optional Cypher query to retrieve data from the database.
@@ -183,4 +167,3 @@ Converts data from a Apache AGE graph database into a Networkx directed graph.
 # Call the function to convert data into a Networkx graph
 graph = age_to_networkx(connection, graphName="MyGraph" )
 ```
-
diff --git a/drivers/python/age/VERSION.py b/drivers/python/age/VERSION.py
index 5136181a..3b014ea5 100644
--- a/drivers/python/age/VERSION.py
+++ b/drivers/python/age/VERSION.py
@@ -1,22 +1,22 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-
-VER_MAJOR = 1
-VER_MINOR = 0
-VER_MICRO = 0
-
-VERSION = '.'.join([str(VER_MAJOR),str(VER_MINOR),str(VER_MICRO)])
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+
+VER_MAJOR = 1
+VER_MINOR = 0
+VER_MICRO = 0
+
+VERSION = '.'.join([str(VER_MAJOR),str(VER_MINOR),str(VER_MICRO)])
diff --git a/drivers/python/age/__init__.py b/drivers/python/age/__init__.py
index 2da5ef10..fd50135a 100644
--- a/drivers/python/age/__init__.py
+++ b/drivers/python/age/__init__.py
@@ -1,41 +1,40 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import psycopg.conninfo as conninfo
-from . import age
-from .age import *
-from .age import AgeLoader, ClientCursor, configure_connection
-from .models import *
-from .builder import ResultHandler, DummyResultHandler, parseAgeValue, newResultHandler
-from . import VERSION 
-
-def version():
-    return VERSION.VERSION
-
-
-def connect(dsn=None, graph=None, connection_factory=None, cursor_factory=ClientCursor, load_from_plugins=False,
-            skip_load=False, **kwargs):
-
-    dsn = conninfo.make_conninfo('' if dsn is None else dsn, **kwargs)
-
-    ag = Age()
-    ag.connect(dsn=dsn, graph=graph, connection_factory=connection_factory, cursor_factory=cursor_factory,
-               load_from_plugins=load_from_plugins, skip_load=skip_load, **kwargs)
-    return ag
-
-# Dummy ResultHandler
-rawPrinter = DummyResultHandler()
-
-__name__="age"
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import psycopg.conninfo as conninfo
+from . import age
+from .age import *
+from .models import *
+from .builder import ResultHandler, DummyResultHandler, parseAgeValue, newResultHandler
+from . import VERSION 
+
+def version():
+    return VERSION.VERSION
+
+
+def connect(dsn=None, graph=None, connection_factory=None, cursor_factory=ClientCursor, load_from_plugins=False,
+            **kwargs):
+
+    dsn = conninfo.make_conninfo('' if dsn is None else dsn, **kwargs)
+
+    ag = Age()
+    ag.connect(dsn=dsn, graph=graph, connection_factory=connection_factory, cursor_factory=cursor_factory,
+               load_from_plugins=load_from_plugins, **kwargs)
+    return ag
+
+# Dummy ResultHandler
+rawPrinter = DummyResultHandler()
+
+__name__="age"
diff --git a/drivers/python/age/age.py b/drivers/python/age/age.py
index a580936a..817cc6e5 100644
--- a/drivers/python/age/age.py
+++ b/drivers/python/age/age.py
@@ -1,457 +1,235 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import re
-from typing import Any, Optional
-
-import psycopg
-from psycopg.types import TypeInfo
-from psycopg import sql
-from psycopg.client_cursor import ClientCursor
-from .exceptions import *
-from .builder import parseAgeValue
-
-
-_EXCEPTION_NoConnection = NoConnection()
-_EXCEPTION_GraphNotSet = GraphNotSet()
-
-WHITESPACE = re.compile(r'\s')
-
-# Valid AGE graph name pattern aligned with Apache AGE's internal validation
-# and Neo4j/openCypher naming conventions.
-# Start: letter or underscore
-# Middle: letter, digit, underscore, dot, or hyphen
-# End: letter, digit, or underscore
-#
-# Design note: The middle segment uses `*` (not `+`) intentionally.
-# This makes the regex match names as short as 2 characters at the
-# regex level. However, validate_graph_name() checks MIN_GRAPH_NAME_LENGTH
-# *before* applying this regex, so 2-character names are rejected with a
-# clear "must be at least 3 characters" error rather than a confusing
-# regex-mismatch error. This ordering gives users actionable feedback.
-VALID_GRAPH_NAME = re.compile(r'^[A-Za-z_][A-Za-z0-9_.\-]*[A-Za-z0-9_]$')
-MIN_GRAPH_NAME_LENGTH = 3
-
-# Valid SQL identifier for labels, column names, and types.
-# Stricter than graph names — no dots or hyphens.
-VALID_IDENTIFIER = re.compile(r'^[A-Za-z_][A-Za-z0-9_]*$')
-MAX_IDENTIFIER_LENGTH = 63
-
-
-def validate_graph_name(graph_name: str) -> None:
-    """Validate that a graph name conforms to Apache AGE's naming rules.
-
-    Graph names must:
-    - Be at least 3 characters and at most 63 characters
-    - Start with a letter or underscore
-    - Contain only letters, digits, underscores, dots, and hyphens
-    - End with a letter, digit, or underscore
-
-    This aligns with AGE's internal validation and Neo4j/openCypher
-    naming conventions.
-
-    Args:
-        graph_name: The graph name to validate.
-
-    Raises:
-        InvalidGraphName: If the graph name is invalid.
-    """
-    if not graph_name or not isinstance(graph_name, str):
-        raise InvalidGraphName(
-            str(graph_name),
-            "Graph name must be a non-empty string."
-        )
-    if len(graph_name) < MIN_GRAPH_NAME_LENGTH:
-        raise InvalidGraphName(
-            graph_name,
-            f"Graph names must be at least {MIN_GRAPH_NAME_LENGTH} characters."
-        )
-    if len(graph_name) > MAX_IDENTIFIER_LENGTH:
-        raise InvalidGraphName(
-            graph_name,
-            f"Must not exceed {MAX_IDENTIFIER_LENGTH} characters "
-            "(PostgreSQL name limit)."
-        )
-    if not VALID_GRAPH_NAME.match(graph_name):
-        raise InvalidGraphName(
-            graph_name,
-            "Graph names must start with a letter or underscore, "
-            "may contain letters, digits, underscores, dots, and hyphens, "
-            "and must end with a letter, digit, or underscore."
-        )
-
-
-def validate_identifier(name: str, context: str = "identifier") -> None:
-    """Validate that a name is a safe SQL identifier for labels, columns, or types.
-
-    This follows stricter rules than graph names — only letters, digits,
-    and underscores are permitted (no dots or hyphens).
-
-    Args:
-        name: The identifier to validate.
-        context: What the identifier represents (for error messages).
-
-    Raises:
-        InvalidIdentifier: If the identifier is invalid.
-    """
-    if not name or not isinstance(name, str):
-        raise InvalidIdentifier(
-            str(name),
-            f"{context} must be a non-empty string."
-        )
-    if len(name) > MAX_IDENTIFIER_LENGTH:
-        raise InvalidIdentifier(
-            name,
-            f"{context} must not exceed {MAX_IDENTIFIER_LENGTH} characters."
-        )
-    if not VALID_IDENTIFIER.match(name):
-        raise InvalidIdentifier(
-            name,
-            f"{context} must start with a letter or underscore "
-            "and contain only letters, digits, and underscores."
-        )
-
-
-class AgeDumper(psycopg.adapt.Dumper):
-    def dump(self, obj: Any) -> bytes | bytearray | memoryview:
-        pass
-
-
-class AgeLoader(psycopg.adapt.Loader):
-    def load(self, data: bytes | bytearray | memoryview) -> Any | None:
-        if isinstance(data, memoryview):
-            data_bytes = data.tobytes()
-        else:
-            data_bytes = data
-
-        return parseAgeValue(data_bytes.decode('utf-8'))
-
-
-def setUpAge(conn:psycopg.connection, graphName:str, load_from_plugins:bool=False, skip_load:bool=False):
-    if skip_load and load_from_plugins:
-        raise ValueError(
-            "skip_load=True and load_from_plugins=True are contradictory. "
-            "Set skip_load=False to load the extension from the plugins path, "
-            "or remove load_from_plugins to skip loading entirely."
-        )
-
-    with conn.cursor() as cursor:
-        if not skip_load:
-            if load_from_plugins:
-                cursor.execute("LOAD '$libdir/plugins/age';")
-            else:
-                cursor.execute("LOAD 'age';")
-
-        cursor.execute('SET search_path = ag_catalog, "$user", public;')
-
-        ag_info = TypeInfo.fetch(conn, 'agtype')
-
-        if not ag_info:
-            raise AgeNotSet(
-                "AGE agtype type not found. Ensure the AGE extension is "
-                "installed and loaded in the current database. "
-                "Run CREATE EXTENSION age; first."
-            )
-
-        conn.adapters.register_loader(ag_info.oid, AgeLoader)
-        conn.adapters.register_loader(ag_info.array_oid, AgeLoader)
-
-        # Check graph exists
-        if graphName != None:
-            checkGraphCreated(conn, graphName)
-
-
-def configure_connection(
-    conn: psycopg.connection,
-    graph_name: Optional[str] = None,
-    load: bool = False,
-    load_from_plugins: bool = False,
-) -> None:
-    """Register AGE agtype adapters on an existing connection.
-
-    This enables use of AGE with externally-managed connections, such as
-    those from psycopg_pool.ConnectionPool.  By default the function does
-    **not** execute ``LOAD 'age'``, making it safe for managed PostgreSQL
-    services (Azure, AWS RDS) where the extension is pre-loaded via
-    ``shared_preload_libraries``.
-
-    Performs:
-    - ``SET search_path`` to include ``ag_catalog``
-    - Fetches agtype OIDs and registers ``AgeLoader``
-    - Optionally loads the AGE extension (``load=True``)
-    - Optionally checks/creates the graph
-
-    Args:
-        conn: An existing psycopg connection.
-        graph_name: Optional graph name to check/create.
-        load: If True, execute ``LOAD 'age'`` (or the plugins path).
-            Default False — suitable for environments where AGE is
-            already loaded.
-        load_from_plugins: If True (and ``load=True``), use
-            ``LOAD '$libdir/plugins/age'`` instead of ``LOAD 'age'``.
-
-    Raises:
-        ValueError: If ``load_from_plugins=True`` but ``load=False``.
-        AgeNotSet: If the agtype type is not found in the database.
-    """
-    if load_from_plugins and not load:
-        raise ValueError(
-            "load_from_plugins=True requires load=True. "
-            "Set load=True to enable extension loading."
-        )
-
-    with conn.cursor() as cursor:
-        if load:
-            if load_from_plugins:
-                cursor.execute("LOAD '$libdir/plugins/age';")
-            else:
-                cursor.execute("LOAD 'age';")
-
-        cursor.execute('SET search_path = ag_catalog, "$user", public;')
-
-        ag_info = TypeInfo.fetch(conn, 'agtype')
-
-    if not ag_info:
-        raise AgeNotSet(
-            "AGE agtype type not found. Ensure the AGE extension is "
-            "installed and loaded in the current database. "
-            "Run CREATE EXTENSION age; first."
-        )
-
-    conn.adapters.register_loader(ag_info.oid, AgeLoader)
-    conn.adapters.register_loader(ag_info.array_oid, AgeLoader)
-
-    if graph_name is not None:
-        checkGraphCreated(conn, graph_name)
-
-
-# Create the graph, if it does not exist
-def checkGraphCreated(conn:psycopg.connection, graphName:str):
-    validate_graph_name(graphName)
-    with conn.cursor() as cursor:
-        cursor.execute(sql.SQL("SELECT count(*) FROM ag_graph WHERE name={graphName}").format(graphName=sql.Literal(graphName)))
-        if cursor.fetchone()[0] == 0:
-            cursor.execute(sql.SQL("SELECT create_graph({graphName});").format(graphName=sql.Literal(graphName)))
-            conn.commit()
-
-
-def deleteGraph(conn:psycopg.connection, graphName:str):
-    validate_graph_name(graphName)
-    with conn.cursor() as cursor:
-        cursor.execute(sql.SQL("SELECT drop_graph({graphName}, true);").format(graphName=sql.Literal(graphName)))
-        conn.commit()
-
-
-def _validate_column(col: str) -> str:
-    """Validate and normalize a column specification for use in SQL.
-
-    Accepts either a plain column name (e.g. 'v') or a name with type
-    (e.g. 'v agtype'). Validates each component to prevent SQL injection.
-
-    Args:
-        col: Column specification string.
-
-    Returns:
-        Normalized column specification, or empty string if blank.
-
-    Raises:
-        InvalidIdentifier: If any component is invalid.
-    """
-    col = col.strip()
-    if not col:
-        return ''
-
-    if WHITESPACE.search(col):
-        parts = col.split()
-        if len(parts) != 2:
-            raise InvalidIdentifier(
-                col,
-                "Column specification must be 'name' or 'name type'."
-            )
-        name, type_name = parts
-        validate_identifier(name, "Column name")
-        validate_identifier(type_name, "Column type")
-        # Only the column name is double-quoted.  The type name is left
-        # unquoted so PostgreSQL applies its default identifier folding
-        # for type names in column definitions.  Double-quoting would
-        # make the type name case-sensitive and could change type
-        # resolution in surprising ways for user-defined types.
-        return f'"{name}" {type_name}'
-    else:
-        validate_identifier(col, "Column name")
-        return f'"{col}" agtype'
-
-
-def buildCypher(graphName:str, cypherStmt:str, columns:list) ->str:
-    if graphName is None:
-        raise _EXCEPTION_GraphNotSet
-
-    columnExp=[]
-    if columns != None and len(columns) > 0:
-        for col in columns:
-            validated = _validate_column(col)
-            if validated:
-                columnExp.append(validated)
-    else:
-        columnExp.append('"v" agtype')
-
-    # Design note: String concatenation is used here instead of
-    # psycopg.sql.Identifier() because column specifications are
-    # "name type" pairs (e.g. '"v" agtype') that don't map directly to
-    # sql.Identifier(). Each component has already been validated by
-    # _validate_column() → validate_identifier(), which restricts
-    # names to ^[A-Za-z_][A-Za-z0-9_]*$ and max 63 chars. Column names
-    # are always double-quoted to avoid conflicts with PostgreSQL
-    # reserved words (e.g. "count", "order", "type"). The graphName
-    # and cypherStmt are NOT embedded here — this template only
-    # contains the validated column list and static SQL keywords.
-    stmtArr = []
-    stmtArr.append("SELECT * from cypher(NULL,NULL) as (")
-    stmtArr.append(','.join(columnExp))
-    stmtArr.append(");")
-    return "".join(stmtArr)
-
-def execSql(conn:psycopg.connection, stmt:str, commit:bool=False, params:tuple=None) -> psycopg.cursor :
-    if conn == None or conn.closed:
-        raise _EXCEPTION_NoConnection
-    
-    cursor = conn.cursor()
-    try:
-        cursor.execute(stmt, params)
-        if commit:
-            conn.commit()
-
-        return cursor
-    except SyntaxError as cause:
-        conn.rollback()
-        raise cause
-    except Exception as cause:
-        conn.rollback()
-        raise SqlExecutionError("Execution ERR[" + str(cause) +"](" + stmt +")", cause)
-
-
-def querySql(conn:psycopg.connection, stmt:str, params:tuple=None) -> psycopg.cursor :
-    return execSql(conn, stmt, False, params)
-
-# Execute cypher statement and return cursor.
-# If cypher statement changes data (create, set, remove),
-# You must commit session(ag.commit())
-# (Otherwise the execution cannot make any effect.)
-def execCypher(conn:psycopg.connection, graphName:str, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
-    if conn == None or conn.closed:
-        raise _EXCEPTION_NoConnection
-
-    cursor = conn.cursor()
-    #clean up the string for mogrification
-    cypherStmt = cypherStmt.replace("\n", "")
-    cypherStmt = cypherStmt.replace("\t", "")
-    cypher = str(cursor.mogrify(cypherStmt, params))
-    cypher = cypher.strip()
-
-    preparedStmt = "SELECT * FROM age_prepare_cypher({graphName},{cypherStmt})"
-
-    cursor = conn.cursor()
-    try:
-        cursor.execute(sql.SQL(preparedStmt).format(graphName=sql.Literal(graphName),cypherStmt=sql.Literal(cypher)))
-    except SyntaxError as cause:
-        conn.rollback()
-        raise cause
-    except Exception as cause:
-        conn.rollback()
-        raise SqlExecutionError("Execution ERR[" + str(cause) +"](" + preparedStmt +")", cause)
-
-    stmt = buildCypher(graphName, cypher, cols)
-
-    cursor = conn.cursor()
-    try:
-        cursor.execute(stmt)
-        return cursor
-    except SyntaxError as cause:
-        conn.rollback()
-        raise cause
-    except Exception as cause:
-        conn.rollback()
-        raise SqlExecutionError("Execution ERR[" + str(cause) +"](" + stmt +")", cause)
-
-
-def cypher(cursor:psycopg.cursor, graphName:str, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
-    #clean up the string for mogrification
-    cypherStmt = cypherStmt.replace("\n", "")
-    cypherStmt = cypherStmt.replace("\t", "")
-    cypher = str(cursor.mogrify(cypherStmt, params))
-    cypher = cypher.strip()
-
-    preparedStmt = "SELECT * FROM age_prepare_cypher({graphName},{cypherStmt})"
-    cursor.execute(sql.SQL(preparedStmt).format(graphName=sql.Literal(graphName),cypherStmt=sql.Literal(cypher)))
-
-    stmt = buildCypher(graphName, cypher, cols)
-    cursor.execute(stmt)
-
-
-# def execCypherWithReturn(conn:psycopg.connection, graphName:str, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
-#     stmt = buildCypher(graphName, cypherStmt, columns)
-#     return execSql(conn, stmt, False, params)
-
-# def queryCypher(conn:psycopg.connection, graphName:str, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
-#     return execCypherWithReturn(conn, graphName, cypherStmt, columns, params)
-
-
-class Age:
-    def __init__(self):
-        self.connection = None    # psycopg connection]
-        self.graphName = None
-
-    # Connect to PostgreSQL Server and establish session and type extension environment.
-    def connect(self, graph:str=None, dsn:str=None, connection_factory=None, cursor_factory=ClientCursor,
-                load_from_plugins:bool=False, skip_load:bool=False, **kwargs):
-        conn = psycopg.connect(dsn, cursor_factory=cursor_factory, **kwargs)
-        setUpAge(conn, graph, load_from_plugins, skip_load=skip_load)
-        self.connection = conn
-        self.graphName = graph
-        return self
-
-    def close(self):
-        self.connection.close()
-
-    def setGraph(self, graph:str):
-        checkGraphCreated(self.connection, graph)
-        self.graphName = graph
-        return self
-
-    def commit(self):
-        self.connection.commit()
-
-    def rollback(self):
-        self.connection.rollback()
-
-    def execCypher(self, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
-        return execCypher(self.connection, self.graphName, cypherStmt, cols=cols, params=params)
-
-    def cypher(self, cursor:psycopg.cursor, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
-        return cypher(cursor, self.graphName, cypherStmt, cols=cols, params=params)
-
-    # def execSql(self, stmt:str, commit:bool=False, params:tuple=None) -> psycopg.cursor :
-    #     return execSql(self.connection, stmt, commit, params)
-
-
-    # def execCypher(self, cypherStmt:str, commit:bool=False, params:tuple=None) -> psycopg.cursor :
-    #     return execCypher(self.connection, self.graphName, cypherStmt, commit, params)
-
-    # def execCypherWithReturn(self, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
-    #     return execCypherWithReturn(self.connection, self.graphName, cypherStmt, columns, params)
-
-    # def queryCypher(self, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
-    #     return queryCypher(self.connection, self.graphName, cypherStmt, columns, params)
-
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import re
+import psycopg
+from psycopg.types import TypeInfo
+from psycopg.adapt import Loader
+from psycopg import sql
+from psycopg.client_cursor import ClientCursor
+from .exceptions import *
+from .builder import parseAgeValue
+
+
+_EXCEPTION_NoConnection = NoConnection()
+_EXCEPTION_GraphNotSet = GraphNotSet()
+
+WHITESPACE = re.compile('\s')
+
+
+class AgeDumper(psycopg.adapt.Dumper):
+    def dump(self, obj: Any) -> bytes | bytearray | memoryview:
+        pass    
+    
+    
+class AgeLoader(psycopg.adapt.Loader):    
+    def load(self, data: bytes | bytearray | memoryview) -> Any | None:
+        if isinstance(data, memoryview):
+            data_bytes = data.tobytes()
+        else:
+            data_bytes = data
+
+        return parseAgeValue(data_bytes.decode('utf-8'))
+
+
+def setUpAge(conn:psycopg.connection, graphName:str, load_from_plugins:bool=False):
+    with conn.cursor() as cursor:
+        if load_from_plugins:
+            cursor.execute("LOAD '$libdir/plugins/age';")
+        else:
+            cursor.execute("LOAD 'age';")
+
+        cursor.execute("SET search_path = ag_catalog, '$user', public;")
+
+        ag_info = TypeInfo.fetch(conn, 'agtype')
+
+        if not ag_info:
+            raise AgeNotSet()
+
+        conn.adapters.register_loader(ag_info.oid, AgeLoader)
+        conn.adapters.register_loader(ag_info.array_oid, AgeLoader)
+
+        # Check graph exists
+        if graphName != None:
+            checkGraphCreated(conn, graphName)
+
+# Create the graph, if it does not exist
+def checkGraphCreated(conn:psycopg.connection, graphName:str):
+    with conn.cursor() as cursor:
+        cursor.execute(sql.SQL("SELECT count(*) FROM ag_graph WHERE name={graphName}").format(graphName=sql.Literal(graphName)))
+        if cursor.fetchone()[0] == 0:
+            cursor.execute(sql.SQL("SELECT create_graph({graphName});").format(graphName=sql.Literal(graphName)))
+            conn.commit()
+
+
+def deleteGraph(conn:psycopg.connection, graphName:str):
+    with conn.cursor() as cursor:
+        cursor.execute(sql.SQL("SELECT drop_graph({graphName}, true);").format(graphName=sql.Literal(graphName)))
+        conn.commit()
+
+
+def buildCypher(graphName:str, cypherStmt:str, columns:list) ->str:
+    if graphName == None:
+        raise _EXCEPTION_GraphNotSet
+    
+    columnExp=[]
+    if columns != None and len(columns) > 0:
+        for col in columns:
+            if col.strip() == '':
+                continue
+            elif WHITESPACE.search(col) != None:
+                columnExp.append(col)
+            else:
+                columnExp.append(col + " agtype")
+    else:
+        columnExp.append('v agtype')
+
+    stmtArr = []
+    stmtArr.append("SELECT * from cypher(NULL,NULL) as (")
+    stmtArr.append(','.join(columnExp))
+    stmtArr.append(");")
+    return "".join(stmtArr)
+
+def execSql(conn:psycopg.connection, stmt:str, commit:bool=False, params:tuple=None) -> psycopg.cursor :
+    if conn == None or conn.closed:
+        raise _EXCEPTION_NoConnection
+    
+    cursor = conn.cursor()
+    try:
+        cursor.execute(stmt, params)
+        if commit:
+            conn.commit()
+
+        return cursor
+    except SyntaxError as cause:
+        conn.rollback()
+        raise cause
+    except Exception as cause:
+        conn.rollback()
+        raise SqlExecutionError("Execution ERR[" + str(cause) +"](" + stmt +")", cause)
+
+
+def querySql(conn:psycopg.connection, stmt:str, params:tuple=None) -> psycopg.cursor :
+    return execSql(conn, stmt, False, params)
+
+# Execute cypher statement and return cursor.
+# If cypher statement changes data (create, set, remove),
+# You must commit session(ag.commit())
+# (Otherwise the execution cannot make any effect.)
+def execCypher(conn:psycopg.connection, graphName:str, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
+    if conn == None or conn.closed:
+        raise _EXCEPTION_NoConnection
+
+    cursor = conn.cursor()
+    #clean up the string for mogrification
+    cypherStmt = cypherStmt.replace("\n", "")
+    cypherStmt = cypherStmt.replace("\t", "")
+    cypher = str(cursor.mogrify(cypherStmt, params))
+    cypher = cypher.strip()
+
+    preparedStmt = "SELECT * FROM age_prepare_cypher({graphName},{cypherStmt})"
+
+    cursor = conn.cursor()
+    try:
+        cursor.execute(sql.SQL(preparedStmt).format(graphName=sql.Literal(graphName),cypherStmt=sql.Literal(cypher)))
+    except SyntaxError as cause:
+        conn.rollback()
+        raise cause
+    except Exception as cause:
+        conn.rollback()
+        raise SqlExecutionError("Execution ERR[" + str(cause) +"](" + preparedStmt +")", cause)
+
+    stmt = buildCypher(graphName, cypher, cols)
+
+    cursor = conn.cursor()
+    try:
+        cursor.execute(stmt)
+        return cursor
+    except SyntaxError as cause:
+        conn.rollback()
+        raise cause
+    except Exception as cause:
+        conn.rollback()
+        raise SqlExecutionError("Execution ERR[" + str(cause) +"](" + stmt +")", cause)
+
+
+def cypher(cursor:psycopg.cursor, graphName:str, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
+    #clean up the string for mogrification
+    cypherStmt = cypherStmt.replace("\n", "")
+    cypherStmt = cypherStmt.replace("\t", "")
+    cypher = str(cursor.mogrify(cypherStmt, params))
+    cypher = cypher.strip()
+
+    preparedStmt = "SELECT * FROM age_prepare_cypher({graphName},{cypherStmt})"
+    cursor.execute(sql.SQL(preparedStmt).format(graphName=sql.Literal(graphName),cypherStmt=sql.Literal(cypher)))
+
+    stmt = buildCypher(graphName, cypher, cols)
+    cursor.execute(stmt)
+
+
+# def execCypherWithReturn(conn:psycopg.connection, graphName:str, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
+#     stmt = buildCypher(graphName, cypherStmt, columns)
+#     return execSql(conn, stmt, False, params)
+
+# def queryCypher(conn:psycopg.connection, graphName:str, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
+#     return execCypherWithReturn(conn, graphName, cypherStmt, columns, params)
+
+
+class Age:
+    def __init__(self):
+        self.connection = None    # psycopg connection]
+        self.graphName = None
+
+    # Connect to PostgreSQL Server and establish session and type extension environment.
+    def connect(self, graph:str=None, dsn:str=None, connection_factory=None, cursor_factory=ClientCursor,
+                load_from_plugins:bool=False, **kwargs):
+        conn = psycopg.connect(dsn, cursor_factory=cursor_factory, **kwargs)
+        setUpAge(conn, graph, load_from_plugins)
+        self.connection = conn
+        self.graphName = graph
+        return self
+
+    def close(self):
+        self.connection.close()
+
+    def setGraph(self, graph:str):
+        checkGraphCreated(self.connection, graph)
+        self.graphName = graph
+        return self
+
+    def commit(self):
+        self.connection.commit()
+
+    def rollback(self):
+        self.connection.rollback()
+
+    def execCypher(self, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
+        return execCypher(self.connection, self.graphName, cypherStmt, cols=cols, params=params)
+
+    def cypher(self, cursor:psycopg.cursor, cypherStmt:str, cols:list=None, params:tuple=None) -> psycopg.cursor :
+        return cypher(cursor, self.graphName, cypherStmt, cols=cols, params=params)
+
+    # def execSql(self, stmt:str, commit:bool=False, params:tuple=None) -> psycopg.cursor :
+    #     return execSql(self.connection, stmt, commit, params)
+
+
+    # def execCypher(self, cypherStmt:str, commit:bool=False, params:tuple=None) -> psycopg.cursor :
+    #     return execCypher(self.connection, self.graphName, cypherStmt, commit, params)
+
+    # def execCypherWithReturn(self, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
+    #     return execCypherWithReturn(self.connection, self.graphName, cypherStmt, columns, params)
+
+    # def queryCypher(self, cypherStmt:str, columns:list=None , params:tuple=None) -> psycopg.cursor :
+    #     return queryCypher(self.connection, self.graphName, cypherStmt, columns, params)
diff --git a/drivers/python/age/builder.py b/drivers/python/age/builder.py
index b4f746e7..a3815b82 100644
--- a/drivers/python/age/builder.py
+++ b/drivers/python/age/builder.py
@@ -1,252 +1,210 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-from . import gen
-from .gen.AgtypeLexer import AgtypeLexer
-from .gen.AgtypeParser import AgtypeParser
-from .gen.AgtypeVisitor import AgtypeVisitor
-from .models import *
-from .exceptions import *
-from antlr4 import InputStream, CommonTokenStream, ParserRuleContext
-from antlr4.tree.Tree import TerminalNode
-from decimal import Decimal
-
-resultHandler = None
-
-class ResultHandler:
-    def parse(ageData):
-        pass
-
-def newResultHandler(query=""):
-    resultHandler = Antlr4ResultHandler(None, query)
-    return resultHandler
-
-def parseAgeValue(value, cursor=None):
-    if value is None:
-        return None
-
-    global resultHandler
-    if (resultHandler == None):
-        resultHandler = Antlr4ResultHandler(None)
-    try:
-        return resultHandler.parse(value)
-    except Exception as ex:
-        raise AGTypeError(value, ex)
-
-
-class Antlr4ResultHandler(ResultHandler):
-    def __init__(self, vertexCache, query=None):
-        self.lexer = AgtypeLexer()
-        self.parser = AgtypeParser(None)
-        self.visitor = ResultVisitor(vertexCache)
-
-    def parse(self, ageData):
-        if not ageData:
-            return None
-        # print("Parse::", ageData)
-
-        self.lexer.inputStream = InputStream(ageData)
-        self.parser.setTokenStream(CommonTokenStream(self.lexer))
-        self.parser.reset()
-        tree = self.parser.agType()
-        parsed = tree.accept(self.visitor)
-        return parsed
-
-
-# print raw result String
-class DummyResultHandler(ResultHandler):
-    def parse(self, ageData):
-        print(ageData)
-
-# default agType visitor
-class ResultVisitor(AgtypeVisitor):
-    vertexCache = None
-
-    def __init__(self, cache) -> None:
-        super().__init__()
-        self.vertexCache = cache
-
-    
-    def visitAgType(self, ctx:AgtypeParser.AgTypeContext):
-        agVal = ctx.agValue()
-        if agVal != None:
-            obj = ctx.agValue().accept(self)
-            return obj
-
-        return None
-
-    def visitAgValue(self, ctx:AgtypeParser.AgValueContext):
-        annoCtx = ctx.typeAnnotation()
-        valueCtx = ctx.value()
-
-        if annoCtx is not None:
-            annoCtx.accept(self)
-            identNode = annoCtx.IDENT()
-            if identNode is None:
-                raise AGTypeError(ctx.getText(), "Missing type annotation identifier")
-            anno = identNode.getText()
-            if valueCtx is None:
-                raise AGTypeError(ctx.getText(), "Missing value for annotated type")
-            return self.handleAnnotatedValue(anno, valueCtx)
-        else:
-            if valueCtx is None:
-                return None
-            return valueCtx.accept(self)
-
-
-    @staticmethod
-    def _stripStringDelimiters(stringToken):
-        # The STRING token always has surrounding '"' delimiters per the
-        # Agtype grammar; slice rather than strip('"') so escaped quotes
-        # at the boundaries are preserved.
-        return stringToken.getText()[1:-1]
-
-    # Visit a parse tree produced by AgtypeParser#StringValue.
-    def visitStringValue(self, ctx:AgtypeParser.StringValueContext):
-        return self._stripStringDelimiters(ctx.STRING())
-
-
-    # Visit a parse tree produced by AgtypeParser#IntegerValue.
-    def visitIntegerValue(self, ctx:AgtypeParser.IntegerValueContext):
-        return int(ctx.INTEGER().getText())
-
-    # Visit a parse tree produced by AgtypeParser#floatLiteral.
-    def visitFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext):
-        text = ctx.getText()
-        c = ctx.getChild(0)
-        if c is None or not hasattr(c, 'symbol') or c.symbol is None:
-            raise AGTypeError(
-                str(text),
-                "Malformed float literal: missing or invalid child node"
-            )
-        tp = c.symbol.type
-        if tp == AgtypeParser.RegularFloat:
-            return float(text)
-        elif tp == AgtypeParser.ExponentFloat:
-            return float(text)
-        else:
-            if text == 'NaN':
-                return float('nan')
-            elif text == '-Infinity':
-                return float('-inf')
-            elif text == 'Infinity':
-                return float('inf')
-            else:
-                raise ValueError("Unknown float expression: " + text)
-        
-
-    # Visit a parse tree produced by AgtypeParser#TrueBoolean.
-    def visitTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext):
-        return True
-
-
-    # Visit a parse tree produced by AgtypeParser#FalseBoolean.
-    def visitFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext):
-        return False
-
-
-    # Visit a parse tree produced by AgtypeParser#NullValue.
-    def visitNullValue(self, ctx:AgtypeParser.NullValueContext):
-        return None
-
-
-    # Visit a parse tree produced by AgtypeParser#obj.
-    def visitObj(self, ctx:AgtypeParser.ObjContext):
-        obj = dict()
-        for c in ctx.getChildren():
-            if isinstance(c, AgtypeParser.PairContext):
-                namVal = self.visitPair(c)
-                name = namVal[0]
-                valCtx = namVal[1]
-                # visitPair() raises AGTypeError when the value node is
-                # missing, so valCtx should never be None here.  The
-                # guard is kept as a defensive fallback only.
-                if valCtx is not None:
-                    val = valCtx.accept(self) 
-                    obj[name] = val
-                else:
-                    obj[name] = None
-        return obj
-
-
-    # Visit a parse tree produced by AgtypeParser#pair.
-    def visitPair(self, ctx:AgtypeParser.PairContext):
-        self.visitChildren(ctx)
-        strNode = ctx.STRING()
-        agValNode = ctx.agValue()
-        if strNode is None:
-            raise AGTypeError(ctx.getText(), "Missing key in object pair")
-        if agValNode is None:
-            raise AGTypeError(ctx.getText(), "Missing value in object pair")
-        return (self._stripStringDelimiters(strNode), agValNode)
-
-
-    # Visit a parse tree produced by AgtypeParser#array.
-    def visitArray(self, ctx:AgtypeParser.ArrayContext):
-        li = list()
-        for c in ctx.getChildren():
-            if not isinstance(c, TerminalNode):
-                val = c.accept(self)
-                li.append(val)
-        return li
-
-    def handleAnnotatedValue(self, anno:str, ctx:ParserRuleContext):
-        # Each branch below constructs a model object (Vertex, Edge, Path)
-        # and populates it from the parsed dict/list.  If a type check
-        # fails (e.g. the parsed value is not a dict), AGTypeError is
-        # raised and the partially-constructed object is discarded — no
-        # cleanup is needed because the caller propagates the exception.
-        if anno == "numeric":
-            return Decimal(ctx.getText())
-        elif anno == "vertex":
-            d = ctx.accept(self)
-            if not isinstance(d, dict):
-                raise AGTypeError(str(ctx.getText()), "Expected dict for vertex, got " + type(d).__name__)
-            vid = d.get("id")
-            vertex = None
-            if self.vertexCache is not None and vid in self.vertexCache:
-                vertex = self.vertexCache[vid]
-            else:
-                vertex = Vertex()
-                vertex.id = d.get("id")
-                vertex.label = d.get("label")
-                vertex.properties = d.get("properties") or {}
-            
-            if self.vertexCache is not None:
-                self.vertexCache[vid] = vertex
-
-            return vertex
-        
-        elif anno == "edge":
-            edge = Edge()
-            d = ctx.accept(self)
-            if not isinstance(d, dict):
-                raise AGTypeError(str(ctx.getText()), "Expected dict for edge, got " + type(d).__name__)
-            edge.id = d.get("id")
-            edge.label = d.get("label")
-            edge.end_id = d.get("end_id")
-            edge.start_id = d.get("start_id")
-            edge.properties = d.get("properties") or {}
-            
-            return edge
-
-        elif anno == "path":
-            arr = ctx.accept(self)
-            if not isinstance(arr, list):
-                raise AGTypeError(str(ctx.getText()), "Expected list for path, got " + type(arr).__name__)
-            path = Path(arr)
-            
-            return path
-
-        return ctx.accept(self)
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from . import gen
+from .gen.AgtypeLexer import AgtypeLexer
+from .gen.AgtypeParser import AgtypeParser
+from .gen.AgtypeVisitor import AgtypeVisitor
+from .models import *
+from .exceptions import *
+from antlr4 import InputStream, CommonTokenStream, ParserRuleContext
+from antlr4.tree.Tree import TerminalNode
+from decimal import Decimal
+
+resultHandler = None
+
+class ResultHandler:
+    def parse(ageData):
+        pass
+
+def newResultHandler(query=""):
+    resultHandler = Antlr4ResultHandler(None, query)
+    return resultHandler
+
+def parseAgeValue(value, cursor=None):
+    if value is None:
+        return None
+
+    global resultHandler
+    if (resultHandler == None):
+        resultHandler = Antlr4ResultHandler(None)
+    try:
+        return resultHandler.parse(value)
+    except Exception as ex:
+        raise AGTypeError(value, ex)
+
+
+class Antlr4ResultHandler(ResultHandler):
+    def __init__(self, vertexCache, query=None):
+        self.lexer = AgtypeLexer()
+        self.parser = AgtypeParser(None)
+        self.visitor = ResultVisitor(vertexCache)
+
+    def parse(self, ageData):
+        if not ageData:
+            return None
+        # print("Parse::", ageData)
+
+        self.lexer.inputStream = InputStream(ageData)
+        self.parser.setTokenStream(CommonTokenStream(self.lexer))
+        self.parser.reset()
+        tree = self.parser.agType()
+        parsed = tree.accept(self.visitor)
+        return parsed
+
+
+# print raw result String
+class DummyResultHandler(ResultHandler):
+    def parse(self, ageData):
+        print(ageData)
+
+# default agType visitor
+class ResultVisitor(AgtypeVisitor):
+    vertexCache = None
+
+    def __init__(self, cache) -> None:
+        super().__init__()
+        self.vertexCache = cache
+
+    
+    def visitAgType(self, ctx:AgtypeParser.AgTypeContext):
+        agVal = ctx.agValue()
+        if agVal != None:
+            obj = ctx.agValue().accept(self)
+            return obj
+
+        return None
+
+    def visitAgValue(self, ctx:AgtypeParser.AgValueContext):
+        annoCtx = ctx.typeAnnotation()
+        valueCtx = ctx.value()
+
+        if annoCtx is not None:
+            annoCtx.accept(self)
+            anno = annoCtx.IDENT().getText()
+            return self.handleAnnotatedValue(anno, valueCtx)
+        else:
+            return valueCtx.accept(self)
+
+
+    # Visit a parse tree produced by AgtypeParser#StringValue.
+    def visitStringValue(self, ctx:AgtypeParser.StringValueContext):
+        return ctx.STRING().getText().strip('"')
+
+
+    # Visit a parse tree produced by AgtypeParser#IntegerValue.
+    def visitIntegerValue(self, ctx:AgtypeParser.IntegerValueContext):
+        return int(ctx.INTEGER().getText())
+
+    # Visit a parse tree produced by AgtypeParser#floatLiteral.
+    def visitFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext):
+        c = ctx.getChild(0)
+        tp = c.symbol.type
+        text = ctx.getText()
+        if tp == AgtypeParser.RegularFloat:
+            return float(text)
+        elif tp == AgtypeParser.ExponentFloat:
+            return float(text)
+        else:
+            if text == 'NaN':
+                return float('nan')
+            elif text == '-Infinity':
+                return float('-inf')
+            elif text == 'Infinity':
+                return float('inf')
+            else:
+                return Exception("Unknown float expression:"+text)
+        
+
+    # Visit a parse tree produced by AgtypeParser#TrueBoolean.
+    def visitTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext):
+        return True
+
+
+    # Visit a parse tree produced by AgtypeParser#FalseBoolean.
+    def visitFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext):
+        return False
+
+
+    # Visit a parse tree produced by AgtypeParser#NullValue.
+    def visitNullValue(self, ctx:AgtypeParser.NullValueContext):
+        return None
+
+
+    # Visit a parse tree produced by AgtypeParser#obj.
+    def visitObj(self, ctx:AgtypeParser.ObjContext):
+        obj = dict()
+        for c in ctx.getChildren():
+            if isinstance(c, AgtypeParser.PairContext):
+                namVal = self.visitPair(c)
+                name = namVal[0]
+                valCtx = namVal[1]
+                val = valCtx.accept(self) 
+                obj[name] = val
+        return obj
+
+
+    # Visit a parse tree produced by AgtypeParser#pair.
+    def visitPair(self, ctx:AgtypeParser.PairContext):
+        self.visitChildren(ctx)
+        return (ctx.STRING().getText().strip('"') , ctx.agValue())
+
+
+    # Visit a parse tree produced by AgtypeParser#array.
+    def visitArray(self, ctx:AgtypeParser.ArrayContext):
+        li = list()
+        for c in ctx.getChildren():
+            if not isinstance(c, TerminalNode):
+                val = c.accept(self)
+                li.append(val)
+        return li
+
+    def handleAnnotatedValue(self, anno:str, ctx:ParserRuleContext):
+        if anno == "numeric":
+            return Decimal(ctx.getText())
+        elif anno == "vertex":
+            dict = ctx.accept(self)
+            vid = dict["id"]
+            vertex = None
+            if self.vertexCache != None and vid in self.vertexCache :
+                vertex = self.vertexCache[vid]
+            else:
+                vertex = Vertex()
+                vertex.id = dict["id"]
+                vertex.label = dict["label"]
+                vertex.properties = dict["properties"]
+            
+            if self.vertexCache != None:
+                self.vertexCache[vid] = vertex
+
+            return vertex
+        
+        elif anno == "edge":
+            edge = Edge()
+            dict = ctx.accept(self)
+            edge.id = dict["id"]
+            edge.label = dict["label"]
+            edge.end_id = dict["end_id"]
+            edge.start_id = dict["start_id"]
+            edge.properties = dict["properties"]
+            
+            return edge
+
+        elif anno == "path":
+            arr = ctx.accept(self)
+            path = Path(arr)
+            
+            return path
+
+        return ctx.accept(self)
diff --git a/drivers/python/age/exceptions.py b/drivers/python/age/exceptions.py
index 18292cc0..3aa94f4b 100644
--- a/drivers/python/age/exceptions.py
+++ b/drivers/python/age/exceptions.py
@@ -16,74 +16,39 @@
 from psycopg.errors import *
 
 class AgeNotSet(Exception):
-    def __init__(self, name=None):
+    def __init__(self, name):
         self.name = name
-        super().__init__(name or 'AGE extension is not set.')
 
-    def __repr__(self):
+    def __repr__(self) :
         return 'AGE extension is not set.'
 
 class GraphNotFound(Exception):
-    def __init__(self, name=None):
+    def __init__(self, name):
         self.name = name
-        super().__init__(f'Graph[{name}] does not exist.' if name else 'Graph does not exist.')
 
-    def __repr__(self):
-        if self.name:
-            return 'Graph[' + self.name + '] does not exist.'
-        return 'Graph does not exist.'
+    def __repr__(self) :
+        return 'Graph[' + self.name + '] does not exist.'
 
 
 class GraphAlreadyExists(Exception):
-    def __init__(self, name=None):
+    def __init__(self, name):
         self.name = name
-        super().__init__(f'Graph[{name}] already exists.' if name else 'Graph already exists.')
 
-    def __repr__(self):
-        if self.name:
-            return 'Graph[' + self.name + '] already exists.'
-        return 'Graph already exists.'
-
-
-class InvalidGraphName(Exception):
-    """Raised when a graph name contains invalid characters."""
-    def __init__(self, name, reason=None):
-        self.name = name
-        self.reason = reason
-        msg = f"Invalid graph name: '{name}'."
-        if reason:
-            msg += f" {reason}"
-        super().__init__(msg)
-
-    def __repr__(self):
-        return f"InvalidGraphName('{self.name}')"
-
-
-class InvalidIdentifier(Exception):
-    """Raised when an identifier (column, label, etc.) is invalid."""
-    def __init__(self, name, context=None):
-        self.name = name
-        self.context = context
-        msg = f"Invalid identifier: '{name}'."
-        if context:
-            msg += f" {context}"
-        super().__init__(msg)
-
-    def __repr__(self):
-        return f"InvalidIdentifier('{self.name}')"
+    def __repr__(self) :
+        return 'Graph[' + self.name + '] already exists.'
 
 
 class GraphNotSet(Exception):
-    def __repr__(self):
+    def __repr__(self) :
         return 'Graph name is not set.'
 
 
 class NoConnection(Exception):
-    def __repr__(self):
+    def __repr__(self) :
         return 'No Connection'
 
 class NoCursor(Exception):
-    def __repr__(self):
+    def __repr__(self) :
         return 'No Cursor'
 
 class SqlExecutionError(Exception):
@@ -92,7 +57,7 @@ class SqlExecutionError(Exception):
         self.cause = cause
         super().__init__(msg, cause)
 
-    def __repr__(self):
+    def __repr__(self) :
         return 'SqlExecution [' + self.msg + ']'
 
 class AGTypeError(Exception):
diff --git a/drivers/python/age/gen/AgtypeLexer.py b/drivers/python/age/gen/AgtypeLexer.py
index f94dc828..54f19c7d 100644
--- a/drivers/python/age/gen/AgtypeLexer.py
+++ b/drivers/python/age/gen/AgtypeLexer.py
@@ -12,7 +12,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# Generated from ../Agtype.g4 by ANTLR 4.13.2
+# Generated from ../Agtype.g4 by ANTLR 4.11.1
+
 from antlr4 import *
 from io import StringIO
 import sys
@@ -141,7 +142,9 @@ class AgtypeLexer(Lexer):
 
     def __init__(self, input=None, output:TextIO = sys.stdout):
         super().__init__(input, output)
-        self.checkVersion("4.13.2")
+        self.checkVersion("4.11.1")
         self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
         self._actions = None
         self._predicates = None
+
+
diff --git a/drivers/python/age/gen/AgtypeListener.py b/drivers/python/age/gen/AgtypeListener.py
index 39751ac5..6e60da42 100644
--- a/drivers/python/age/gen/AgtypeListener.py
+++ b/drivers/python/age/gen/AgtypeListener.py
@@ -12,9 +12,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# Generated from ../Agtype.g4 by ANTLR 4.13.2
+# Generated from ../Agtype.g4 by ANTLR 4.11.1
+
 from antlr4 import *
-if "." in __name__:
+if __name__ is not None and "." in __name__:
     from .AgtypeParser import AgtypeParser
 else:
     from AgtypeParser import AgtypeParser
@@ -158,4 +159,4 @@ class AgtypeListener(ParseTreeListener):
 
 
 
-del AgtypeParser
+del AgtypeParser
\ No newline at end of file
diff --git a/drivers/python/age/gen/AgtypeParser.py b/drivers/python/age/gen/AgtypeParser.py
index 19a43d08..daaf578e 100644
--- a/drivers/python/age/gen/AgtypeParser.py
+++ b/drivers/python/age/gen/AgtypeParser.py
@@ -12,8 +12,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# Generated from ../Agtype.g4 by ANTLR 4.13.2
+# Generated from ../Agtype.g4 by ANTLR 4.11.1
 # encoding: utf-8
+
 from antlr4 import *
 from io import StringIO
 import sys
@@ -107,7 +108,7 @@ class AgtypeParser ( Parser ):
 
     def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
         super().__init__(input, output)
-        self.checkVersion("4.13.2")
+        self.checkVersion("4.11.1")
         self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
         self._predicates = None
 
@@ -853,3 +854,5 @@ class AgtypeParser ( Parser ):
         finally:
             self.exitRule()
         return localctx
+
+
diff --git a/drivers/python/age/gen/AgtypeVisitor.py b/drivers/python/age/gen/AgtypeVisitor.py
index 8ea2f147..824eb512 100644
--- a/drivers/python/age/gen/AgtypeVisitor.py
+++ b/drivers/python/age/gen/AgtypeVisitor.py
@@ -12,9 +12,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# Generated from ../Agtype.g4 by ANTLR 4.13.2
+# Generated from ../Agtype.g4 by ANTLR 4.11.1
+
 from antlr4 import *
-if "." in __name__:
+if __name__ is not None and "." in __name__:
     from .AgtypeParser import AgtypeParser
 else:
     from AgtypeParser import AgtypeParser
@@ -99,4 +100,4 @@ class AgtypeVisitor(ParseTreeVisitor):
 
 
 
-del AgtypeParser
+del AgtypeParser
\ No newline at end of file
diff --git a/drivers/python/age/models.py b/drivers/python/age/models.py
index 62215c16..aee1b759 100644
--- a/drivers/python/age/models.py
+++ b/drivers/python/age/models.py
@@ -1,334 +1,294 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import json
-from io import StringIO 
-
-
-TP_NONE = 0
-TP_VERTEX = 1
-TP_EDGE = 2
-TP_PATH = 3
-
-
-class Graph():
-    def __init__(self, stmt=None) -> None:
-        self.statement = stmt
-        self.rows = list()
-        self.vertices = dict()
-
-    def __iter__(self):
-        return self.rows.__iter__()
-
-    def __len__(self):
-        return self.rows.__len__()
-
-    def __getitem__(self,index):
-        return self.rows[index]
-        
-    def size(self):
-        return self.rows.__len__()
-
-    def append(self, agObj):
-        self.rows.append(agObj)
-    
-    def getVertices(self):
-        return self.vertices
-    
-    def getVertex(self, id):
-        if id in self.vertices:
-            return self.vertices[id]
-        else:
-            return None
-
-class AGObj:
-    @property
-    def gtype(self):
-        return TP_NONE
-
-
-class Path(AGObj):
-    entities = []
-    def __init__(self, entities=None) -> None:
-        self.entities = entities
-
-    @property
-    def gtype(self):
-        return TP_PATH
-
-    def __iter__(self):
-        return self.entities.__iter__()
-
-    def __len__(self):
-        return self.entities.__len__()
-
-    def __getitem__(self,index):
-        return self.entities[index]
-        
-    def size(self):
-        return self.entities.__len__()
-
-    def append(self, agObj:AGObj ):
-        self.entities.append(agObj)
-    
-    def __str__(self) -> str:
-        return self.toString()
-
-    def __repr__(self) -> str:
-        return self.toString()
-
-    def toString(self) -> str: 
-        buf = StringIO()
-        buf.write("[")
-        max = len(self.entities)
-        idx = 0
-        while idx < max:
-            if idx > 0:
-                buf.write(",")
-            self.entities[idx]._toString(buf)
-            idx += 1
-        buf.write("]::PATH")
-
-        return buf.getvalue()
-
-    def toJson(self) -> str:
-        buf = StringIO()
-        buf.write("{\"gtype\": \"path\", \"elements\": [")
-        
-        max = len(self.entities)
-        idx = 0
-        while idx < max:
-            if idx > 0:
-                buf.write(",")
-            self.entities[idx]._toJson(buf)
-            idx += 1
-        buf.write("]}")
-
-        return buf.getvalue()
-
-    def to_dict(self) -> list:
-        # AGObj elements are recursively converted; JSON-native types
-        # (dict, list, str, int, float, bool, None) pass through unchanged.
-        # Non-serializable objects fall back to str() as a safety net.
-        result = []
-        for e in (self.entities or []):
-            if isinstance(e, AGObj):
-                result.append(e.to_dict())
-            elif isinstance(e, (dict, list, str, int, float, bool, type(None))):
-                result.append(e)
-            else:
-                result.append(str(e))
-        return result
-
-
-    
-
-class Vertex(AGObj):
-    def __init__(self, id=None, label=None, properties=None) -> None:
-        self.id = id
-        self.label = label
-        self.properties = properties
-
-    @property
-    def gtype(self):
-        return TP_VERTEX
-
-    def __setitem__(self,name, value):
-        self.properties[name]=value
-        
-    def __getitem__(self,name):
-        if name in self.properties:
-            return self.properties[name]
-        else:
-            return None
-
-    def __str__(self) -> str:
-        return self.toString()
-
-    def __repr__(self) -> str:
-        return self.toString()
-
-    def to_dict(self) -> dict:
-        """Return a plain dict suitable for JSON serialization.
-
-        Properties are shallow-copied; nested mutable values will share
-        references with the original Vertex.
-        """
-        return {
-            "id": self.id,
-            "label": self.label,
-            "properties": dict(self.properties) if self.properties else {},
-        }
-
-    def toString(self) -> str: 
-        return nodeToString(self)
-
-    def _toString(self, buf): 
-        _nodeToString(self, buf)
-
-    def toJson(self) -> str:
-        return nodeToJson(self)
-
-    def _toJson(self, buf): 
-        _nodeToJson(self, buf)
-
-
-class Edge(AGObj):
-    def __init__(self, id=None, label=None, properties=None) -> None:
-        self.id = id
-        self.label = label
-        self.start_id = None
-        self.end_id = None
-        self.properties = properties
-
-    @property
-    def gtype(self):
-        return TP_EDGE
-
-    def __setitem__(self,name, value):
-        self.properties[name]=value
-        
-    def __getitem__(self,name):
-        if name in self.properties:
-            return self.properties[name]
-        else:
-            return None
-
-    def __str__(self) -> str:
-        return self.toString()
-
-    def __repr__(self) -> str:
-        return self.toString()
-
-    def to_dict(self) -> dict:
-        """Return a plain dict suitable for JSON serialization.
-
-        Properties are shallow-copied; nested mutable values will share
-        references with the original Edge.
-        """
-        return {
-            "id": self.id,
-            "label": self.label,
-            "start_id": self.start_id,
-            "end_id": self.end_id,
-            "properties": dict(self.properties) if self.properties else {},
-        }
-
-    def extraStrFormat(node, buf):
-        if node.start_id != None:
-            buf.write(", start_id:")
-            buf.write(str(node.start_id))
-
-        if node.end_id != None:
-            buf.write(", end_id:")
-            buf.write(str(node.end_id))
-
-
-    def toString(self) -> str: 
-        return nodeToString(self, Edge.extraStrFormat)
-
-    def _toString(self, buf): 
-        _nodeToString(self, buf, Edge.extraStrFormat)
-
-    def extraJsonFormat(node, buf):
-        if node.start_id != None:
-            buf.write(", \"start_id\": \"")
-            buf.write(str(node.start_id))
-            buf.write("\"")
-
-        if node.end_id != None:
-            buf.write(", \"end_id\": \"")
-            buf.write(str(node.end_id))
-            buf.write("\"")
-
-    def toJson(self) -> str:
-        return nodeToJson(self, Edge.extraJsonFormat)
-
-    def _toJson(self, buf): 
-        _nodeToJson(self, buf, Edge.extraJsonFormat)
-
-
-def nodeToString(node, extraFormatter=None):
-    buf = StringIO() 
-    _nodeToString(node,buf,extraFormatter=extraFormatter)
-    return buf.getvalue()
-
-
-def _nodeToString(node, buf, extraFormatter=None):
-    buf.write("{")
-    if node.label != None:
-        buf.write("label:")
-        buf.write(node.label)
-        
-    if node.id != None:
-        buf.write(", id:")
-        buf.write(str(node.id))
-        
-    if node.properties != None:
-        buf.write(", properties:{")
-        prop_list = []
-        for k, v in node.properties.items():
-            prop_list.append(f"{k}: {str(v)}")
-
-        # Join properties with comma and write to buffer
-        buf.write(", ".join(prop_list))
-        buf.write("}")
-
-    if extraFormatter != None:
-        extraFormatter(node, buf)
-        
-    if node.gtype == TP_VERTEX:
-        buf.write("}::VERTEX")
-    if node.gtype == TP_EDGE:
-        buf.write("}::EDGE")
-
-
-def nodeToJson(node, extraFormatter=None):
-    buf = StringIO()
-    _nodeToJson(node, buf, extraFormatter=extraFormatter)
-    return buf.getvalue()
-
-
-def _nodeToJson(node, buf, extraFormatter=None):
-    buf.write("{\"gtype\": ")
-    if node.gtype == TP_VERTEX:
-        buf.write("\"vertex\", ")
-    if node.gtype == TP_EDGE:
-        buf.write("\"edge\", ")
-
-    if node.label != None:
-        buf.write("\"label\":\"")
-        buf.write(node.label)
-        buf.write("\"")
-        
-    if node.id != None:
-        buf.write(", \"id\":")
-        buf.write(str(node.id))
-        
-    if extraFormatter != None:
-        extraFormatter(node, buf)
-        
-    if node.properties != None:
-        buf.write(", \"properties\":{")
-
-        prop_list = []
-        for k, v in node.properties.items():
-            prop_list.append(f"\"{k}\": \"{str(v)}\"")
-
-        # Join properties with comma and write to buffer
-        buf.write(", ".join(prop_list))
-        buf.write("}")
-    buf.write("}")
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import json
+from io import StringIO 
+
+
+TP_NONE = 0
+TP_VERTEX = 1
+TP_EDGE = 2
+TP_PATH = 3
+
+
+class Graph():
+    def __init__(self, stmt=None) -> None:
+        self.statement = stmt
+        self.rows = list()
+        self.vertices = dict()
+
+    def __iter__(self):
+        return self.rows.__iter__()
+
+    def __len__(self):
+        return self.rows.__len__()
+
+    def __getitem__(self,index):
+        return self.rows[index]
+        
+    def size(self):
+        return self.rows.__len__()
+
+    def append(self, agObj):
+        self.rows.append(agObj)
+    
+    def getVertices(self):
+        return self.vertices
+    
+    def getVertex(self, id):
+        if id in self.vertices:
+            return self.vertices[id]
+        else:
+            return None
+
+class AGObj:
+    @property
+    def gtype(self):
+        return TP_NONE
+
+
+class Path(AGObj):
+    entities = []
+    def __init__(self, entities=None) -> None:
+        self.entities = entities
+
+    @property
+    def gtype(self):
+        return TP_PATH
+
+    def __iter__(self):
+        return self.entities.__iter__()
+
+    def __len__(self):
+        return self.entities.__len__()
+
+    def __getitem__(self,index):
+        return self.entities[index]
+        
+    def size(self):
+        return self.entities.__len__()
+
+    def append(self, agObj:AGObj ):
+        self.entities.append(agObj)
+    
+    def __str__(self) -> str:
+        return self.toString()
+
+    def __repr__(self) -> str:
+        return self.toString()
+
+    def toString(self) -> str: 
+        buf = StringIO()
+        buf.write("[")
+        max = len(self.entities)
+        idx = 0
+        while idx < max:
+            if idx > 0:
+                buf.write(",")
+            self.entities[idx]._toString(buf)
+            idx += 1
+        buf.write("]::PATH")
+
+        return buf.getvalue()
+
+    def toJson(self) -> str:
+        buf = StringIO()
+        buf.write("{\"gtype\": \"path\", \"elements\": [")
+        
+        max = len(self.entities)
+        idx = 0
+        while idx < max:
+            if idx > 0:
+                buf.write(",")
+            self.entities[idx]._toJson(buf)
+            idx += 1
+        buf.write("]}")
+
+        return buf.getvalue()
+
+
+    
+
+class Vertex(AGObj):
+    def __init__(self, id=None, label=None, properties=None) -> None:
+        self.id = id
+        self.label = label
+        self.properties = properties
+
+    @property
+    def gtype(self):
+        return TP_VERTEX
+
+    def __setitem__(self,name, value):
+        self.properties[name]=value
+        
+    def __getitem__(self,name):
+        if name in self.properties:
+            return self.properties[name]
+        else:
+            return None
+
+    def __str__(self) -> str:
+        return self.toString()
+
+    def __repr__(self) -> str:
+        return self.toString()
+
+    def toString(self) -> str: 
+        return nodeToString(self)
+
+    def _toString(self, buf): 
+        _nodeToString(self, buf)
+
+    def toJson(self) -> str:
+        return nodeToJson(self)
+
+    def _toJson(self, buf): 
+        _nodeToJson(self, buf)
+
+
+class Edge(AGObj):
+    def __init__(self, id=None, label=None, properties=None) -> None:
+        self.id = id
+        self.label = label
+        self.start_id = None
+        self.end_id = None
+        self.properties = properties
+
+    @property
+    def gtype(self):
+        return TP_EDGE
+
+    def __setitem__(self,name, value):
+        self.properties[name]=value
+        
+    def __getitem__(self,name):
+        if name in self.properties:
+            return self.properties[name]
+        else:
+            return None
+
+    def __str__(self) -> str:
+        return self.toString()
+
+    def __repr__(self) -> str:
+        return self.toString()
+
+    def extraStrFormat(node, buf):
+        if node.start_id != None:
+            buf.write(", start_id:")
+            buf.write(str(node.start_id))
+
+        if node.end_id != None:
+            buf.write(", end_id:")
+            buf.write(str(node.end_id))
+
+
+    def toString(self) -> str: 
+        return nodeToString(self, Edge.extraStrFormat)
+
+    def _toString(self, buf): 
+        _nodeToString(self, buf, Edge.extraStrFormat)
+
+    def extraJsonFormat(node, buf):
+        if node.start_id != None:
+            buf.write(", \"start_id\": \"")
+            buf.write(str(node.start_id))
+            buf.write("\"")
+
+        if node.end_id != None:
+            buf.write(", \"end_id\": \"")
+            buf.write(str(node.end_id))
+            buf.write("\"")
+
+    def toJson(self) -> str:
+        return nodeToJson(self, Edge.extraJsonFormat)
+
+    def _toJson(self, buf): 
+        _nodeToJson(self, buf, Edge.extraJsonFormat)
+
+
+def nodeToString(node, extraFormatter=None):
+    buf = StringIO() 
+    _nodeToString(node,buf,extraFormatter=extraFormatter)
+    return buf.getvalue()
+
+
+def _nodeToString(node, buf, extraFormatter=None):
+    buf.write("{")
+    if node.label != None:
+        buf.write("label:")
+        buf.write(node.label)
+        
+    if node.id != None:
+        buf.write(", id:")
+        buf.write(str(node.id))
+        
+    if node.properties != None:
+        buf.write(", properties:{")
+        prop_list = []
+        for k, v in node.properties.items():
+            prop_list.append(f"{k}: {str(v)}")
+
+        # Join properties with comma and write to buffer
+        buf.write(", ".join(prop_list))
+        buf.write("}")
+
+    if extraFormatter != None:
+        extraFormatter(node, buf)
+        
+    if node.gtype == TP_VERTEX:
+        buf.write("}::VERTEX")
+    if node.gtype == TP_EDGE:
+        buf.write("}::EDGE")
+
+
+def nodeToJson(node, extraFormatter=None):
+    buf = StringIO()
+    _nodeToJson(node, buf, extraFormatter=extraFormatter)
+    return buf.getvalue()
+
+
+def _nodeToJson(node, buf, extraFormatter=None):
+    buf.write("{\"gtype\": ")
+    if node.gtype == TP_VERTEX:
+        buf.write("\"vertex\", ")
+    if node.gtype == TP_EDGE:
+        buf.write("\"edge\", ")
+
+    if node.label != None:
+        buf.write("\"label\":\"")
+        buf.write(node.label)
+        buf.write("\"")
+        
+    if node.id != None:
+        buf.write(", \"id\":")
+        buf.write(str(node.id))
+        
+    if extraFormatter != None:
+        extraFormatter(node, buf)
+        
+    if node.properties != None:
+        buf.write(", \"properties\":{")
+
+        prop_list = []
+        for k, v in node.properties.items():
+            prop_list.append(f"\"{k}\": \"{str(v)}\"")
+
+        # Join properties with comma and write to buffer
+        buf.write(", ".join(prop_list))
+        buf.write("}")
+    buf.write("}")
     
\ No newline at end of file
diff --git a/drivers/python/age/networkx/lib.py b/drivers/python/age/networkx/lib.py
index 5df761ea..30865862 100644
--- a/drivers/python/age/networkx/lib.py
+++ b/drivers/python/age/networkx/lib.py
@@ -20,18 +20,17 @@ import networkx as nx
 from psycopg import sql
 from typing import Dict, Any, List, Set
 from age.models import Vertex, Edge, Path
-from age.age import validate_graph_name, validate_identifier
 
 
 def checkIfGraphNameExistInAGE(connection: psycopg.connect,
                                graphName: str):
     """Check if the age graph exists"""
-    validate_graph_name(graphName)
     with connection.cursor() as cursor:
-        cursor.execute(
-            sql.SQL("SELECT count(*) FROM ag_catalog.ag_graph WHERE name={gn}")
-            .format(gn=sql.Literal(graphName))
-        )
+        cursor.execute(sql.SQL("""
+                    SELECT count(*) 
+                    FROM ag_catalog.ag_graph 
+                    WHERE name='%s'
+                """ % (graphName)))
         if cursor.fetchone()[0] == 0:
             raise GraphNotFound(graphName)
 
@@ -39,13 +38,11 @@ def checkIfGraphNameExistInAGE(connection: psycopg.connect,
 def getOidOfGraph(connection: psycopg.connect,
                   graphName: str) -> int:
     """Returns oid of a graph"""
-    validate_graph_name(graphName)
     try:
         with connection.cursor() as cursor:
-            cursor.execute(
-                sql.SQL("SELECT graphid FROM ag_catalog.ag_graph WHERE name={gn}")
-                .format(gn=sql.Literal(graphName))
-            )
+            cursor.execute(sql.SQL("""
+                        SELECT graphid FROM ag_catalog.ag_graph WHERE name='%s' ;
+                    """ % (graphName)))
             oid = cursor.fetchone()[0]
             return oid
     except Exception as e:
@@ -59,9 +56,7 @@ def get_vlabel(connection: psycopg.connect,
     try:
         with connection.cursor() as cursor:
             cursor.execute(
-                sql.SQL("SELECT name FROM ag_catalog.ag_label WHERE kind='v' AND graph={oid}")
-                .format(oid=sql.Literal(oid))
-            )
+                """SELECT name FROM ag_catalog.ag_label WHERE kind='v' AND graph=%s;""" % oid)
             for row in cursor:
                 node_label_list.append(row[0])
 
@@ -74,19 +69,18 @@ def create_vlabel(connection: psycopg.connect,
                   graphName: str,
                   node_label_list: List):
     """create_vlabels from list if not exist"""
-    validate_graph_name(graphName)
     try:
         node_label_set = set(get_vlabel(connection, graphName))
+        crete_label_statement = ''
         for label in node_label_list:
             if label in node_label_set:
                 continue
-            validate_identifier(label, "Vertex label")
+            crete_label_statement += """SELECT create_vlabel('%s','%s');\n""" % (
+                graphName, label)
+        if crete_label_statement != '':
             with connection.cursor() as cursor:
-                cursor.execute(
-                    sql.SQL("SELECT create_vlabel({gn},{lbl})")
-                    .format(gn=sql.Literal(graphName), lbl=sql.Literal(label))
-                )
-        connection.commit()
+                cursor.execute(crete_label_statement)
+                connection.commit()
     except Exception as e:
         raise Exception(e)
 
@@ -98,9 +92,7 @@ def get_elabel(connection: psycopg.connect,
     try:
         with connection.cursor() as cursor:
             cursor.execute(
-                sql.SQL("SELECT name FROM ag_catalog.ag_label WHERE kind='e' AND graph={oid}")
-                .format(oid=sql.Literal(oid))
-            )
+                """SELECT name FROM ag_catalog.ag_label WHERE kind='e' AND graph=%s;""" % oid)
             for row in cursor:
                 edge_label_list.append(row[0])
     except Exception as ex:
@@ -111,20 +103,19 @@ def get_elabel(connection: psycopg.connect,
 def create_elabel(connection: psycopg.connect,
                   graphName: str,
                   edge_label_list: List):
-    """create_elabels from list if not exist"""
-    validate_graph_name(graphName)
+    """create_vlabels from list if not exist"""
     try:
         edge_label_set = set(get_elabel(connection, graphName))
+        crete_label_statement = ''
         for label in edge_label_list:
             if label in edge_label_set:
                 continue
-            validate_identifier(label, "Edge label")
+            crete_label_statement += """SELECT create_elabel('%s','%s');\n""" % (
+                graphName, label)
+        if crete_label_statement != '':
             with connection.cursor() as cursor:
-                cursor.execute(
-                    sql.SQL("SELECT create_elabel({gn},{lbl})")
-                    .format(gn=sql.Literal(graphName), lbl=sql.Literal(label))
-                )
-        connection.commit()
+                cursor.execute(crete_label_statement)
+                connection.commit()
     except Exception as e:
         raise Exception(e)
 
@@ -180,7 +171,6 @@ def getEdgeLabelListAfterPreprocessing(G: nx.DiGraph):
 
 def addAllNodesIntoAGE(connection: psycopg.connect, graphName: str, G: nx.DiGraph, node_label_list: Set):
     """Add all node to AGE"""
-    validate_graph_name(graphName)
     try:
         queue_data = {label: [] for label in node_label_list}
         id_data = {}
@@ -190,11 +180,8 @@ def addAllNodesIntoAGE(connection: psycopg.connect, graphName: str, G: nx.DiGrap
             queue_data[data['label']].append((json_string,))
 
         for label, rows in queue_data.items():
-            validate_identifier(label, "Node label")
-            insert_query = sql.SQL("INSERT INTO {schema}.{table} (properties) VALUES (%s) RETURNING id").format(
-                schema=sql.Identifier(graphName),
-                table=sql.Identifier(label)
-            )
+            table_name = """%s."%s" """ % (graphName, label)
+            insert_query = f"INSERT INTO {table_name} (properties) VALUES (%s) RETURNING id"
             cursor = connection.cursor()
             cursor.executemany(insert_query, rows, returning=True)
             ids = []
@@ -218,7 +205,6 @@ def addAllNodesIntoAGE(connection: psycopg.connect, graphName: str, G: nx.DiGrap
 
 def addAllEdgesIntoAGE(connection: psycopg.connect, graphName: str, G: nx.DiGraph, edge_label_list: Set):
     """Add all edge to AGE"""
-    validate_graph_name(graphName)
     try:
         queue_data = {label: [] for label in edge_label_list}
         for u, v, data in G.edges(data=True):
@@ -227,11 +213,8 @@ def addAllEdgesIntoAGE(connection: psycopg.connect, graphName: str, G: nx.DiGrap
                 (G.nodes[u]['properties']['__gid__'], G.nodes[v]['properties']['__gid__'], json_string,))
 
         for label, rows in queue_data.items():
-            validate_identifier(label, "Edge label")
-            insert_query = sql.SQL("INSERT INTO {schema}.{table} (start_id,end_id,properties) VALUES (%s, %s, %s)").format(
-                schema=sql.Identifier(graphName),
-                table=sql.Identifier(label)
-            )
+            table_name = """%s."%s" """ % (graphName, label)
+            insert_query = f"INSERT INTO {table_name} (start_id,end_id,properties) VALUES (%s, %s, %s)"
             cursor = connection.cursor()
             cursor.executemany(insert_query, rows)
             connection.commit()
@@ -242,19 +225,14 @@ def addAllEdgesIntoAGE(connection: psycopg.connect, graphName: str, G: nx.DiGrap
 
 def addAllNodesIntoNetworkx(connection: psycopg.connect, graphName: str, G: nx.DiGraph):
     """Add all nodes to Networkx"""
-    validate_graph_name(graphName)
     node_label_list = get_vlabel(connection, graphName)
     try:
         for label in node_label_list:
-            validate_identifier(label, "Node label")
             with connection.cursor() as cursor:
-                cursor.execute(
-                    sql.SQL("SELECT id, CAST(properties AS VARCHAR) FROM {schema}.{table}")
-                    .format(
-                        schema=sql.Identifier(graphName),
-                        table=sql.Identifier(label)
-                    )
-                )
+                cursor.execute("""
+                SELECT id, CAST(properties AS VARCHAR) 
+                FROM %s."%s";
+                """ % (graphName, label))
                 rows = cursor.fetchall()
                 for row in rows:
                     G.add_node(int(row[0]), label=label,
@@ -265,19 +243,14 @@ def addAllNodesIntoNetworkx(connection: psycopg.connect, graphName: str, G: nx.D
 
 def addAllEdgesIntoNetworkx(connection: psycopg.connect, graphName: str, G: nx.DiGraph):
     """Add All edges to Networkx"""
-    validate_graph_name(graphName)
     try:
         edge_label_list = get_elabel(connection, graphName)
         for label in edge_label_list:
-            validate_identifier(label, "Edge label")
             with connection.cursor() as cursor:
-                cursor.execute(
-                    sql.SQL("SELECT start_id, end_id, CAST(properties AS VARCHAR) FROM {schema}.{table}")
-                    .format(
-                        schema=sql.Identifier(graphName),
-                        table=sql.Identifier(label)
-                    )
-                )
+                cursor.execute("""
+                               SELECT start_id, end_id, CAST(properties AS VARCHAR) 
+                               FROM %s."%s";
+                               """ % (graphName, label))
                 rows = cursor.fetchall()
                 for row in rows:
                     G.add_edge(int(row[0]), int(
diff --git a/drivers/python/pyproject.toml b/drivers/python/pyproject.toml
deleted file mode 100644
index 651fc205..00000000
--- a/drivers/python/pyproject.toml
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-[build-system]
-requires = ["setuptools>=61.0", "wheel"]
-build-backend = "setuptools.build_meta"
-
-[project]
-name = "apache-age-python"
-version = "0.0.7"
-description = "Python driver support for Apache AGE"
-readme = "README.md"
-requires-python = ">=3.9"
-license = "Apache-2.0"
-keywords = ["Graph Database", "Apache AGE", "PostgreSQL"]
-authors = [
-    {name = "Ikchan Kwon, Apache AGE", email = "dev-subscribe@age.apache.org"}
-]
-classifiers = [
-    "Programming Language :: Python :: 3.9",
-    "Programming Language :: Python :: 3.10",
-    "Programming Language :: Python :: 3.11",
-    "Programming Language :: Python :: 3.12",
-    "Programming Language :: Python :: 3.13",
-    "Programming Language :: Python :: 3.14",
-]
-dependencies = [
-    "psycopg",
-    # Parser is generated with ANTLR 4.13.2. Runtime is forward- and
-    # backward-compatible within the 4.x series (checkVersion() emits a
-    # warning on mismatch but parsing still works); tested on 4.11.1–4.13.2
-    # with Python 3.9–3.14.
-    "antlr4-python3-runtime>=4.13.2,<5.0",
-]
-
-[project.urls]
-Homepage = "https://github.com/apache/age/tree/master/drivers/python"
-Download = "https://github.com/apache/age/releases"
-
-[tool.setuptools]
-packages = ["age", "age.gen", "age.networkx"]
diff --git a/drivers/python/requirements.txt b/drivers/python/requirements.txt
index ceadc06c..92c42e42 100644
Binary files a/drivers/python/requirements.txt and b/drivers/python/requirements.txt differ
diff --git a/drivers/python/setup.py b/drivers/python/setup.py
index 853f1006..1da49d9c 100644
--- a/drivers/python/setup.py
+++ b/drivers/python/setup.py
@@ -1,22 +1,40 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# This setup.py is maintained for backward compatibility.
-# All package configuration is in pyproject.toml. For installation,
-# use: pip install .
-
-from setuptools import setup
-
-setup()
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from setuptools import setup, find_packages
+from age import VERSION 
+
+with open("README.md", "r", encoding='utf8') as fh:
+    long_description = fh.read()
+
+setup(
+    name             = 'apache-age-python',
+    version          = '0.0.7',
+    description      = 'Python driver support for Apache AGE',
+    long_description=long_description,
+    long_description_content_type="text/markdown",
+    author           = 'Ikchan Kwon, Apache AGE',
+    author_email     = 'dev-subscribe@age.apache.org',
+    url              = 'https://github.com/apache/age/tree/master/drivers/python',
+    download_url     = 'https://github.com/apache/age/releases' ,
+    license          = 'Apache2.0',
+    install_requires = [ 'psycopg', 'antlr4-python3-runtime==4.11.1'],
+    packages         = ['age', 'age.gen','age.networkx'],
+    keywords         = ['Graph Database', 'Apache AGE', 'PostgreSQL'],
+    python_requires  = '>=3.9',
+    classifiers      = [
+        'Programming Language :: Python :: 3.9'
+    ]
+)
diff --git a/drivers/python/test_age_py.py b/drivers/python/test_age_py.py
index bb92f7d5..f904fb9e 100644
--- a/drivers/python/test_age_py.py
+++ b/drivers/python/test_age_py.py
@@ -13,18 +13,11 @@
 # specific language governing permissions and limitations
 # under the License.
 import json
-import re
 
-from age.models import Vertex, Edge, Path
+from age.models import Vertex
 import unittest
-import unittest.mock
 import decimal
 import age
-# _validate_column is private but tested directly because its quoting
-# behavior is security-relevant and the public surface (buildCypher)
-# makes it difficult to isolate quoting assertions.
-from age.age import buildCypher, _validate_column
-from age.exceptions import InvalidIdentifier
 import argparse
 
 TEST_HOST = "localhost"
@@ -35,296 +28,6 @@ TEST_PASSWORD = "agens"
 TEST_GRAPH_NAME = "test_graph"
 
 
-class TestSetUpAge(unittest.TestCase):
-    """Unit tests for setUpAge() skip_load parameter — no DB required."""
-
-    def _make_mock_conn(self):
-        mock_conn = unittest.mock.MagicMock()
-        mock_cursor = unittest.mock.MagicMock()
-        mock_conn.cursor.return_value.__enter__ = unittest.mock.Mock(return_value=mock_cursor)
-        mock_conn.cursor.return_value.__exit__ = unittest.mock.Mock(return_value=False)
-        mock_conn.adapters = unittest.mock.MagicMock()
-        mock_type_info = unittest.mock.MagicMock()
-        mock_type_info.oid = 1
-        mock_type_info.array_oid = 2
-        return mock_conn, mock_cursor, mock_type_info
-
-    def test_skip_load_true_does_not_execute_load(self):
-        """When skip_load=True, LOAD 'age' must not be executed."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.setUpAge(mock_conn, "test_graph", skip_load=True)
-        mock_cursor.execute.assert_called_once_with(
-            'SET search_path = ag_catalog, "$user", public;'
-        )
-
-    def test_skip_load_false_executes_load(self):
-        """When skip_load=False (default), LOAD 'age' must be executed."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.setUpAge(mock_conn, "test_graph", skip_load=False)
-        mock_cursor.execute.assert_any_call("LOAD 'age';")
-
-    def test_skip_load_with_load_from_plugins(self):
-        """When skip_load=False and load_from_plugins=True, LOAD from plugins path."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.setUpAge(mock_conn, "test_graph", load_from_plugins=True, skip_load=False)
-        mock_cursor.execute.assert_any_call("LOAD '$libdir/plugins/age';")
-
-    def test_skip_load_true_still_sets_search_path(self):
-        """When skip_load=True, search_path must still be set."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.setUpAge(mock_conn, "test_graph", skip_load=True)
-        mock_cursor.execute.assert_any_call(
-            'SET search_path = ag_catalog, "$user", public;'
-        )
-
-    def test_contradictory_skip_load_and_load_from_plugins_raises(self):
-        """skip_load=True + load_from_plugins=True must raise ValueError."""
-        mock_conn, _, _ = self._make_mock_conn()
-        with self.assertRaises(ValueError):
-            age.age.setUpAge(mock_conn, "test_graph", load_from_plugins=True, skip_load=True)
-
-    def test_connect_forwards_skip_load_to_setup(self):
-        """age.connect(skip_load=True) must forward skip_load through the full call chain."""
-        with unittest.mock.patch("age.age.psycopg.connect") as mock_psycopg, \
-             unittest.mock.patch("age.age.setUpAge") as mock_setup:
-            mock_psycopg.return_value = unittest.mock.MagicMock()
-            age.connect(dsn="host=localhost", graph="test_graph", skip_load=True)
-        mock_setup.assert_called_once()
-        _, kwargs = mock_setup.call_args
-        self.assertTrue(
-            kwargs.get("skip_load", False),
-            "skip_load must be forwarded from age.connect() to setUpAge()"
-        )
-
-
-class TestBuildCypher(unittest.TestCase):
-    """Unit tests for buildCypher() and _validate_column() — no DB required."""
-
-    def test_simple_column(self):
-        result = buildCypher("g", "MATCH (n) RETURN n", ["n"])
-        self.assertIn('"n" agtype', result)
-
-    def test_column_with_type(self):
-        result = buildCypher("g", "MATCH (n) RETURN n", ["n agtype"])
-        self.assertIn('"n" agtype', result)
-
-    def test_reserved_word_count(self):
-        """Issue #2370: 'count' is a PostgreSQL reserved word."""
-        result = buildCypher("g", "MATCH (n) RETURN count(n)", ["count"])
-        self.assertIn('"count" agtype', result)
-        # Verify 'count' never appears unquoted as a column name
-        self.assertIsNone(
-            re.search(r'(?<!")\bcount\s+agtype\b', result),
-            f"'count' must be quoted in: {result}"
-        )
-
-    def test_reserved_word_order(self):
-        """Issue #2370: 'order' is a PostgreSQL reserved word."""
-        result = buildCypher("g", "MATCH (n) RETURN n.order", ["order"])
-        self.assertIn('"order" agtype', result)
-
-    def test_reserved_word_type(self):
-        """Issue #2370: 'type' is a PostgreSQL reserved word."""
-        result = buildCypher("g", "MATCH ()-[r]->() RETURN type(r)", ["type"])
-        self.assertIn('"type" agtype', result)
-
-    def test_reserved_word_select(self):
-        """Issue #2370: 'select' is a PostgreSQL reserved word."""
-        result = buildCypher("g", "MATCH (n) RETURN n", ["select"])
-        self.assertIn('"select" agtype', result)
-
-    def test_reserved_word_group(self):
-        """Issue #2370: 'group' is a PostgreSQL reserved word."""
-        result = buildCypher("g", "MATCH (n) RETURN n", ["group"])
-        self.assertIn('"group" agtype', result)
-
-    def test_multiple_columns(self):
-        result = buildCypher("g", "MATCH (n) RETURN n.name, count(n)", ["name", "count"])
-        self.assertIn('"name" agtype', result)
-        self.assertIn('"count" agtype', result)
-
-    def test_default_column(self):
-        result = buildCypher("g", "MATCH (n) RETURN n", None)
-        self.assertIn('"v" agtype', result)
-
-    def test_invalid_column_rejected(self):
-        with self.assertRaises(InvalidIdentifier):
-            buildCypher("g", "MATCH (n) RETURN n", ["invalid;col"])
-
-    def test_reserved_word_in_name_type_pair(self):
-        """Quoting applies even when the column is specified as 'name type'."""
-        result = buildCypher("g", "MATCH (n) RETURN n.order", ["order agtype"])
-        self.assertIn('"order" agtype', result)
-
-    def test_validate_column_quoting(self):
-        self.assertEqual(_validate_column("v"), '"v" agtype')
-        self.assertEqual(_validate_column("v agtype"), '"v" agtype')
-        self.assertEqual(_validate_column("count"), '"count" agtype')
-        self.assertEqual(_validate_column("my_col"), '"my_col" agtype')
-
-
-class TestModelToDict(unittest.TestCase):
-    """Unit tests for Vertex/Edge/Path to_dict() — no DB required."""
-
-    def test_vertex_to_dict(self):
-        v = Vertex(id=123, label="Person", properties={"name": "Alice", "age": 30})
-        d = v.to_dict()
-        self.assertEqual(d["id"], 123)
-        self.assertEqual(d["label"], "Person")
-        self.assertEqual(d["properties"], {"name": "Alice", "age": 30})
-        # Verify it's a plain dict (JSON-serializable)
-        json_str = json.dumps(d)
-        self.assertIn("Alice", json_str)
-
-    def test_vertex_to_dict_empty_properties(self):
-        v = Vertex(id=1, label="Empty", properties=None)
-        d = v.to_dict()
-        self.assertEqual(d["properties"], {})
-
-    def test_edge_to_dict(self):
-        e = Edge(id=456, label="KNOWS", properties={"since": 2020})
-        e.start_id = 123
-        e.end_id = 789
-        d = e.to_dict()
-        self.assertEqual(d["id"], 456)
-        self.assertEqual(d["label"], "KNOWS")
-        self.assertEqual(d["start_id"], 123)
-        self.assertEqual(d["end_id"], 789)
-        self.assertEqual(d["properties"], {"since": 2020})
-        json_str = json.dumps(d)
-        self.assertIn("KNOWS", json_str)
-
-    def test_path_to_dict(self):
-        v1 = Vertex(id=1, label="A", properties={"name": "start"})
-        e = Edge(id=10, label="r", properties={"w": 1})
-        e.start_id = 1
-        e.end_id = 2
-        v2 = Vertex(id=2, label="B", properties={"name": "end"})
-        p = Path([v1, e, v2])
-        d = p.to_dict()
-        self.assertEqual(len(d), 3)
-        self.assertEqual(d[0]["label"], "A")
-        self.assertEqual(d[1]["label"], "r")
-        self.assertEqual(d[1]["start_id"], 1)
-        self.assertEqual(d[2]["label"], "B")
-        # Verify the whole path is JSON-serializable
-        json_str = json.dumps(d)
-        self.assertIn("start", json_str)
-
-    def test_vertex_to_dict_is_plain_dict(self):
-        """to_dict() returns standard dict, not a model object."""
-        v = Vertex(id=1, label="X", properties={"k": "v"})
-        d = v.to_dict()
-        self.assertIsInstance(d, dict)
-        self.assertIsInstance(d["properties"], dict)
-
-
-class TestPublicImports(unittest.TestCase):
-    """Verify that public API symbols are importable without type: ignore."""
-
-    def test_import_configure_connection(self):
-        from age import configure_connection
-        self.assertTrue(callable(configure_connection))
-
-    def test_import_age_loader(self):
-        from age import AgeLoader
-        self.assertIsNotNone(AgeLoader)
-
-    def test_import_client_cursor(self):
-        from age import ClientCursor
-        self.assertIsNotNone(ClientCursor)
-
-
-class TestConfigureConnection(unittest.TestCase):
-    """Unit tests for configure_connection() — no DB required."""
-
-    def _make_mock_conn(self):
-        mock_conn = unittest.mock.MagicMock()
-        mock_cursor = unittest.mock.MagicMock()
-        mock_conn.cursor.return_value.__enter__ = unittest.mock.Mock(return_value=mock_cursor)
-        mock_conn.cursor.return_value.__exit__ = unittest.mock.Mock(return_value=False)
-        mock_conn.adapters = unittest.mock.MagicMock()
-        mock_type_info = unittest.mock.MagicMock()
-        mock_type_info.oid = 1
-        mock_type_info.array_oid = 2
-        return mock_conn, mock_cursor, mock_type_info
-
-    def test_default_does_not_load(self):
-        """By default, configure_connection should NOT execute LOAD."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.configure_connection(mock_conn)
-        mock_cursor.execute.assert_called_once_with(
-            'SET search_path = ag_catalog, "$user", public;'
-        )
-
-    def test_load_true_executes_load(self):
-        """When load=True, LOAD 'age' must be executed."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.configure_connection(mock_conn, load=True)
-        mock_cursor.execute.assert_any_call("LOAD 'age';")
-
-    def test_load_from_plugins(self):
-        """When load=True and load_from_plugins=True, use plugins path."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.configure_connection(mock_conn, load=True, load_from_plugins=True)
-        mock_cursor.execute.assert_any_call("LOAD '$libdir/plugins/age';")
-
-    def test_load_from_plugins_without_load_raises(self):
-        """load_from_plugins=True without load=True must raise ValueError."""
-        mock_conn, _, _ = self._make_mock_conn()
-        with self.assertRaises(ValueError):
-            age.age.configure_connection(mock_conn, load_from_plugins=True)
-
-    def test_always_sets_search_path(self):
-        """search_path must always be set regardless of load parameter."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.configure_connection(mock_conn)
-        mock_cursor.execute.assert_any_call(
-            'SET search_path = ag_catalog, "$user", public;'
-        )
-
-    def test_registers_agtype_adapters(self):
-        """AgeLoader must be registered for agtype OIDs."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated"):
-            age.age.configure_connection(mock_conn)
-        mock_conn.adapters.register_loader.assert_any_call(1, age.age.AgeLoader)
-        mock_conn.adapters.register_loader.assert_any_call(2, age.age.AgeLoader)
-
-    def test_graph_name_triggers_check(self):
-        """When graph_name is provided, checkGraphCreated must be called."""
-        mock_conn, mock_cursor, mock_type_info = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=mock_type_info), \
-             unittest.mock.patch("age.age.checkGraphCreated") as mock_check:
-            age.age.configure_connection(mock_conn, graph_name="my_graph")
-        mock_check.assert_called_once_with(mock_conn, "my_graph")
-
-    def test_age_not_set_when_type_info_is_none(self):
-        """AgeNotSet must be raised when TypeInfo.fetch returns None."""
-        from age.exceptions import AgeNotSet
-        mock_conn, _, _ = self._make_mock_conn()
-        with unittest.mock.patch("age.age.TypeInfo.fetch", return_value=None):
-            with self.assertRaises(AgeNotSet):
-                age.age.configure_connection(mock_conn)
-
-
 class TestAgeBasic(unittest.TestCase):
     ag = None
     args: argparse.Namespace = argparse.Namespace(
@@ -745,78 +448,6 @@ class TestAgeBasic(unittest.TestCase):
             self.assertFalse(as_str.endswith(", }}::VERTEX"))
         print("Vertex.toString() 'properties' field is formatted properly.")
 
-    def testConfigureConnection(self):
-        """Integration: configure_connection() on an externally-opened
-        connection must register agtype adapters so cypher queries return
-        real Vertex/Edge/Path objects, and to_dict() must round-trip those
-        parser-produced objects through json.dumps()."""
-        print("\n-------------------------------------------------------")
-        print("Test 8: configure_connection + to_dict end-to-end.....")
-        print("-------------------------------------------------------\n")
-
-        import psycopg
-
-        from age import configure_connection
-
-        dsn = "host={host} port={port} dbname={database} user={user} password={password}".format(
-            **vars(self.args)
-        )
-        # Deliberately bypass age.connect(): the whole point of
-        # configure_connection() is to enable AGE on a caller-managed
-        # connection (e.g. one obtained from psycopg_pool.ConnectionPool).
-        raw = psycopg.connect(dsn)
-        try:
-            configure_connection(raw, graph_name=self.args.graphName, load=True)
-
-            graph = self.args.graphName
-            with raw.cursor() as cur:
-                cur.execute(
-                    f"SELECT * FROM cypher('{graph}', $$ "
-                    "CREATE (a:Person {name: 'Alice'})-[r:KNOWS {since: 2020}]->(b:Person {name: 'Bob'}) "
-                    "RETURN a, r, b "
-                    "$$) AS (a agtype, r agtype, b agtype);"
-                )
-                row = cur.fetchone()
-                raw.commit()
-
-            v_a, e, v_b = row
-            self.assertIsInstance(v_a, Vertex)
-            self.assertIsInstance(e, Edge)
-            self.assertIsInstance(v_b, Vertex)
-            self.assertEqual(v_a["name"], "Alice")
-            self.assertEqual(v_b["name"], "Bob")
-            self.assertEqual(e["since"], 2020)
-
-            payload = {
-                "start": v_a.to_dict(),
-                "edge": e.to_dict(),
-                "end": v_b.to_dict(),
-            }
-            serialised = json.loads(json.dumps(payload))
-            self.assertEqual(serialised["start"]["label"], "Person")
-            self.assertEqual(serialised["edge"]["label"], "KNOWS")
-            self.assertEqual(serialised["edge"]["start_id"], v_a.id)
-            self.assertEqual(serialised["edge"]["end_id"], v_b.id)
-            self.assertEqual(serialised["start"]["properties"]["name"], "Alice")
-
-            with raw.cursor() as cur:
-                cur.execute(
-                    f"SELECT * FROM cypher('{graph}', $$ "
-                    "MATCH p=(:Person)-[:KNOWS]->(:Person) RETURN p "
-                    "$$) AS (p agtype);"
-                )
-                path = cur.fetchone()[0]
-
-            self.assertIsInstance(path, Path)
-            path_dict = json.loads(json.dumps(path.to_dict()))
-            self.assertEqual(len(path_dict), 3)
-            self.assertEqual(path_dict[0]["label"], "Person")
-            self.assertEqual(path_dict[1]["label"], "KNOWS")
-            self.assertEqual(path_dict[2]["label"], "Person")
-            print("\nTest 8 Successful....")
-        finally:
-            raw.close()
-
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser()
@@ -854,14 +485,6 @@ if __name__ == "__main__":
 
     args = parser.parse_args()
     suite = unittest.TestSuite()
-    # Unit tests (no DB required)
-    loader = unittest.TestLoader()
-    suite.addTests(loader.loadTestsFromTestCase(TestSetUpAge))
-    suite.addTests(loader.loadTestsFromTestCase(TestBuildCypher))
-    suite.addTests(loader.loadTestsFromTestCase(TestModelToDict))
-    suite.addTests(loader.loadTestsFromTestCase(TestPublicImports))
-    suite.addTests(loader.loadTestsFromTestCase(TestConfigureConnection))
-    # Integration tests (require DB)
     suite.addTest(TestAgeBasic("testExec"))
     suite.addTest(TestAgeBasic("testQuery"))
     suite.addTest(TestAgeBasic("testChangeData"))
@@ -869,6 +492,5 @@ if __name__ == "__main__":
     suite.addTest(TestAgeBasic("testMultipleEdges"))
     suite.addTest(TestAgeBasic("testCollect"))
     suite.addTest(TestAgeBasic("testSerialization"))
-    suite.addTest(TestAgeBasic("testConfigureConnection"))
     TestAgeBasic.args = args
     unittest.TextTestRunner().run(suite)
diff --git a/drivers/python/test_agtypes.py b/drivers/python/test_agtypes.py
index 7de0f5f5..69bbbc29 100644
--- a/drivers/python/test_agtypes.py
+++ b/drivers/python/test_agtypes.py
@@ -1,322 +1,132 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import json
-import math
-import unittest
-from decimal import Decimal
-
-import age
-
-
-class TestAgtype(unittest.TestCase):
-    resultHandler = None
-
-    def __init__(self, methodName: str) -> None:
-        super().__init__(methodName=methodName)
-        self.resultHandler = age.newResultHandler()
-
-    def parse(self, exp):
-        return self.resultHandler.parse(exp)
-
-    def test_scalar(self):
-        print("\nTesting Scalar Value Parsing. Result : ",  end='')
-
-        mapStr = '{"name": "Smith", "num":123, "yn":true, "bigInt":123456789123456789123456789123456789::numeric}'
-        arrStr = '["name", "Smith", "num", 123, "yn", true, 123456789123456789123456789123456789.8888::numeric]'
-        strStr = '"abcd"'
-        intStr = '1234'
-        floatStr = '1234.56789'
-        floatStr2 = '6.45161290322581e+46'
-        numericStr1 = '12345678901234567890123456789123456789.789::numeric'
-        numericStr2 = '12345678901234567890123456789123456789::numeric'
-        boolStr = 'true'
-        nullStr = ''
-        nanStr = "NaN"
-        infpStr = "Infinity"
-        infnStr = "-Infinity"
-
-        mapVal = self.parse(mapStr)
-        arrVal = self.parse(arrStr)
-        str = self.parse(strStr)
-        intVal = self.parse(intStr)
-        floatVal = self.parse(floatStr)
-        floatVal2 = self.parse(floatStr2)
-        bigFloat = self.parse(numericStr1)
-        bigInt = self.parse(numericStr2)
-        boolVal = self.parse(boolStr)
-        nullVal = self.parse(nullStr)
-        nanVal = self.parse(nanStr)
-        infpVal = self.parse(infpStr)
-        infnVal = self.parse(infnStr)
-
-        self.assertEqual(mapVal, {'name': 'Smith', 'num': 123, 'yn': True, 'bigInt': Decimal(
-            '123456789123456789123456789123456789')})
-        self.assertEqual(arrVal, ["name", "Smith", "num", 123, "yn", True, Decimal(
-            "123456789123456789123456789123456789.8888")])
-        self.assertEqual(str,  "abcd")
-        self.assertEqual(intVal, 1234)
-        self.assertEqual(floatVal, 1234.56789)
-        self.assertEqual(floatVal2, 6.45161290322581e+46)
-        self.assertEqual(bigFloat, Decimal(
-            "12345678901234567890123456789123456789.789"))
-        self.assertEqual(bigInt, Decimal(
-            "12345678901234567890123456789123456789"))
-        self.assertEqual(boolVal, True)
-        self.assertTrue(math.isnan(nanVal))
-        self.assertTrue(math.isinf(infpVal))
-        self.assertTrue(math.isinf(infnVal))
-
-    def test_vertex(self):
-
-        print("\nTesting vertex Parsing. Result : ",  end='')
-
-        vertexExp = '''{"id": 2251799813685425, "label": "Person", 
-            "properties": {"name": "Smith", "numInt":123, "numFloat": 384.23424, 
-            "bigInt":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789::numeric, 
-            "bigFloat":123456789123456789123456789123456789.12345::numeric, 
-            "yn":true, "nullVal": null}}::vertex'''
-
-        vertex = self.parse(vertexExp)
-        self.assertEqual(vertex.id,  2251799813685425)
-        self.assertEqual(vertex.label,  "Person")
-        self.assertEqual(vertex["name"],  "Smith")
-        self.assertEqual(vertex["numInt"],  123)
-        self.assertEqual(vertex["numFloat"],  384.23424)
-        self.assertEqual(vertex["bigInt"],  Decimal(
-            "123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789"))
-        self.assertEqual(vertex["bigFloat"],  Decimal(
-            "123456789123456789123456789123456789.12345"))
-        self.assertEqual(vertex["yn"],  True)
-        self.assertEqual(vertex["nullVal"],  None)
-
-    def test_path(self):
-
-        print("\nTesting Path Parsing. Result : ",  end='')
-
-        pathExp = '''[{"id": 2251799813685425, "label": "Person", "properties": {"name": "Smith"}}::vertex, 
-            {"id": 2533274790396576, "label": "workWith", "end_id": 2251799813685425, "start_id": 2251799813685424, 
-                "properties": {"weight": 3, "bigFloat":123456789123456789123456789.12345::numeric}}::edge, 
-            {"id": 2251799813685424, "label": "Person", "properties": {"name": "Joe"}}::vertex]::path'''
-
-        path = self.parse(pathExp)
-        vertexStart = path[0]
-        edge = path[1]
-        vertexEnd = path[2]
-        self.assertEqual(vertexStart.id,  2251799813685425)
-        self.assertEqual(vertexStart.label,  "Person")
-        self.assertEqual(vertexStart["name"],  "Smith")
-
-        self.assertEqual(edge.id,  2533274790396576)
-        self.assertEqual(edge.label,  "workWith")
-        self.assertEqual(edge["weight"],  3)
-        self.assertEqual(edge["bigFloat"],  Decimal(
-            "123456789123456789123456789.12345"))
-
-        self.assertEqual(vertexEnd.id,  2251799813685424)
-        self.assertEqual(vertexEnd.label,  "Person")
-        self.assertEqual(vertexEnd["name"],  "Joe")
-
-    def test_vertex_large_array_properties(self):
-        """Issue #2367: Parser should handle vertices with large array properties."""
-        vertexExp = (
-            '{"id": 1125899906842625, "label": "TestNode", '
-            '"properties": {"name": "test", '
-            '"tags": ["tag1", "tag2", "tag3", "tag4", "tag5", "tag6", "tag7", '
-            '"tag8", "tag9", "tag10", "tag11", "tag12"]}}::vertex'
-        )
-        vertex = self.parse(vertexExp)
-        self.assertEqual(vertex.id, 1125899906842625)
-        self.assertEqual(vertex.label, "TestNode")
-        self.assertEqual(vertex["name"], "test")
-        self.assertEqual(len(vertex["tags"]), 12)
-        self.assertEqual(vertex["tags"][0], "tag1")
-        self.assertEqual(vertex["tags"][11], "tag12")
-
-    def test_vertex_special_characters_in_properties(self):
-        """Issue #2367: Parser accepts JSON-escaped property strings and UTF-8."""
-        # Input uses json.dumps so quotes, backslashes, and newlines are valid JSON.
-        logical_description = 'Quoted "text", path C:\\tmp\\file, line1\nline2, café 雪'
-        props = json.dumps(
-            {"name": "test", "description": logical_description},
-            ensure_ascii=False,
-        )
-        vertexExp = (
-            '{"id": 1125899906842626, "label": "TestNode", '
-            '"properties": ' + props + '}::vertex'
-        )
-        vertex = self.parse(vertexExp)
-        self.assertEqual(vertex.id, 1125899906842626)
-        self.assertEqual(vertex["name"], "test")
-        # The agtype visitor keeps JSON string escapes as literal characters
-        # (except UTF-8 code points, which decode normally).
-        self.assertEqual(
-            vertex["description"],
-            'Quoted \\"text\\", path C:\\\\tmp\\\\file, line1\\nline2, café 雪',
-        )
-
-    def test_vertex_nested_properties(self):
-        """Issue #2367: Parser should handle deeply nested property structures."""
-        vertexExp = (
-            '{"id": 1125899906842627, "label": "TestNode", '
-            '"properties": {"name": "test", '
-            '"metadata": {"level1": {"level2": {"level3": "deep_value"}}}}}::vertex'
-        )
-        vertex = self.parse(vertexExp)
-        self.assertEqual(vertex.id, 1125899906842627)
-        self.assertEqual(vertex["name"], "test")
-        self.assertEqual(vertex["metadata"]["level1"]["level2"]["level3"], "deep_value")
-
-    def test_vertex_empty_properties(self):
-        """Parser should handle vertices with empty properties dict."""
-        vertexExp = '{"id": 1125899906842628, "label": "EmptyNode", "properties": {}}::vertex'
-        vertex = self.parse(vertexExp)
-        self.assertEqual(vertex.id, 1125899906842628)
-        self.assertEqual(vertex.label, "EmptyNode")
-        self.assertEqual(vertex.properties, {})
-
-    def test_vertex_null_property_values(self):
-        """Parser should handle vertices with null property values."""
-        vertexExp = (
-            '{"id": 1125899906842629, "label": "TestNode", '
-            '"properties": {"name": "test", "optional": null, "also_null": null}}::vertex'
-        )
-        vertex = self.parse(vertexExp)
-        self.assertEqual(vertex["name"], "test")
-        self.assertIsNone(vertex["optional"])
-        self.assertIsNone(vertex["also_null"])
-
-    def test_edge_with_complex_properties(self):
-        """Parser should handle edges with complex property structures."""
-        edgeExp = (
-            '{"id": 2533274790396577, "label": "HAS_RELATION", '
-            '"end_id": 1125899906842625, "start_id": 1125899906842626, '
-            '"properties": {"weight": 3, "tags": ["a", "b", "c"], "active": true}}::edge'
-        )
-        edge = self.parse(edgeExp)
-        self.assertEqual(edge.id, 2533274790396577)
-        self.assertEqual(edge.label, "HAS_RELATION")
-        self.assertEqual(edge.start_id, 1125899906842626)
-        self.assertEqual(edge.end_id, 1125899906842625)
-        self.assertEqual(edge["weight"], 3)
-        self.assertEqual(edge["tags"], ["a", "b", "c"])
-        self.assertEqual(edge["active"], True)
-
-    def test_path_with_multiple_edges(self):
-        """Parser should handle paths with multiple edges and complex properties."""
-        pathExp = (
-            '[{"id": 1, "label": "A", "properties": {"name": "start"}}::vertex, '
-            '{"id": 10, "label": "r1", "end_id": 2, "start_id": 1, "properties": {"w": 1}}::edge, '
-            '{"id": 2, "label": "B", "properties": {"name": "middle"}}::vertex, '
-            '{"id": 11, "label": "r2", "end_id": 3, "start_id": 2, "properties": {"w": 2}}::edge, '
-            '{"id": 3, "label": "C", "properties": {"name": "end"}}::vertex]::path'
-        )
-        path = self.parse(pathExp)
-        self.assertEqual(len(path), 5)
-        self.assertEqual(path[0]["name"], "start")
-        self.assertEqual(path[2]["name"], "middle")
-        self.assertEqual(path[4]["name"], "end")
-
-    def test_empty_input(self):
-        """Parser should handle empty/null input gracefully."""
-        self.assertIsNone(self.parse(''))
-        self.assertIsNone(self.parse(None))
-
-    def test_array_of_mixed_types(self):
-        """Parser should handle arrays with mixed types including nested arrays."""
-        arrStr = '["str", 42, true, null, [1, 2, 3], {"key": "val"}]'
-        result = self.parse(arrStr)
-        self.assertEqual(result[0], "str")
-        self.assertEqual(result[1], 42)
-        self.assertEqual(result[2], True)
-        self.assertIsNone(result[3])
-        self.assertEqual(result[4], [1, 2, 3])
-        self.assertEqual(result[5], {"key": "val"})
-
-    def test_string_value_preserves_inner_quotes(self):
-        """Issue #2418: preserve escaped boundary quotes when stripping.
-
-        visitStringValue must strip only the outer delimiters; otherwise
-        values like '"foo \\"bar\\""' lose their trailing escaped quote.
-        """
-        self.assertEqual(self.parse('"foo \\"bar\\""'), 'foo \\"bar\\"')
-        self.assertEqual(self.parse('"\\"leading"'), '\\"leading')
-        self.assertEqual(self.parse('"trailing\\""'), 'trailing\\"')
-        self.assertEqual(self.parse('""'), '')
-        # Same fix applies to visitPair() for object keys.
-        self.assertEqual(
-            self.parse('{"key\\"q": 1}'),
-            {'key\\"q': 1},
-        )
-
-    def test_malformed_vertex_raises_agtypeerror_or_recovers(self):
-        """Issue #2367: Malformed agtype must raise AGTypeError or recover gracefully."""
-        from age.exceptions import AGTypeError
-
-        malformed_inputs = [
-            '{"id": 1, "label":}::vertex',
-            '{"id": 1, "label": "X", "properties": {}::vertex',
-            '{::vertex',
-            '{"id": 1, "label": "X", "properties": {"key":}}::vertex',
-        ]
-        for inp in malformed_inputs:
-            try:
-                result = self.parse(inp)
-                # Parser recovery is acceptable — verify the result is a
-                # usable Python value (None, container, or model object).
-                self.assertTrue(
-                    result is None
-                    or isinstance(result, (dict, list, tuple))
-                    or hasattr(result, "__dict__"),
-                    f"Recovered to unexpected type {type(result).__name__}: {inp}"
-                )
-            except AGTypeError:
-                pass  # expected
-            except AttributeError:
-                self.fail(
-                    f"Malformed input raised AttributeError instead of "
-                    f"AGTypeError: {inp}"
-                )
-
-    def test_truncated_agtype_does_not_crash(self):
-        """Issue #2367: Truncated agtype must raise AGTypeError or recover, never AttributeError."""
-        from age.exceptions import AGTypeError
-
-        truncated_inputs = [
-            '{"id": 1, "label": "X", "properties": {"name": "te',
-            '{"id": 1, "label": "X"',
-            '[{"id": 1}::vertex, {"id": 2',
-        ]
-        for inp in truncated_inputs:
-            try:
-                result = self.parse(inp)
-                # Recovery is acceptable for truncated input
-                self.assertTrue(
-                    result is None
-                    or isinstance(result, (dict, list, tuple))
-                    or hasattr(result, "__dict__"),
-                    f"Recovered to unexpected type {type(result).__name__}: {inp}"
-                )
-            except AGTypeError:
-                pass  # expected
-            except AttributeError:
-                self.fail(
-                    f"Truncated input raised AttributeError instead of "
-                    f"AGTypeError: {inp}"
-                )
-
-
-if __name__ == '__main__':
-    unittest.main()
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest
+from decimal import Decimal
+import math
+import age
+
+
+class TestAgtype(unittest.TestCase):
+    resultHandler = None
+
+    def __init__(self, methodName: str) -> None:
+        super().__init__(methodName=methodName)
+        self.resultHandler = age.newResultHandler()
+
+    def parse(self, exp):
+        return self.resultHandler.parse(exp)
+
+    def test_scalar(self):
+        print("\nTesting Scalar Value Parsing. Result : ",  end='')
+
+        mapStr = '{"name": "Smith", "num":123, "yn":true, "bigInt":123456789123456789123456789123456789::numeric}'
+        arrStr = '["name", "Smith", "num", 123, "yn", true, 123456789123456789123456789123456789.8888::numeric]'
+        strStr = '"abcd"'
+        intStr = '1234'
+        floatStr = '1234.56789'
+        floatStr2 = '6.45161290322581e+46'
+        numericStr1 = '12345678901234567890123456789123456789.789::numeric'
+        numericStr2 = '12345678901234567890123456789123456789::numeric'
+        boolStr = 'true'
+        nullStr = ''
+        nanStr = "NaN"
+        infpStr = "Infinity"
+        infnStr = "-Infinity"
+
+        mapVal = self.parse(mapStr)
+        arrVal = self.parse(arrStr)
+        str = self.parse(strStr)
+        intVal = self.parse(intStr)
+        floatVal = self.parse(floatStr)
+        floatVal2 = self.parse(floatStr2)
+        bigFloat = self.parse(numericStr1)
+        bigInt = self.parse(numericStr2)
+        boolVal = self.parse(boolStr)
+        nullVal = self.parse(nullStr)
+        nanVal = self.parse(nanStr)
+        infpVal = self.parse(infpStr)
+        infnVal = self.parse(infnStr)
+
+        self.assertEqual(mapVal, {'name': 'Smith', 'num': 123, 'yn': True, 'bigInt': Decimal(
+            '123456789123456789123456789123456789')})
+        self.assertEqual(arrVal, ["name", "Smith", "num", 123, "yn", True, Decimal(
+            "123456789123456789123456789123456789.8888")])
+        self.assertEqual(str,  "abcd")
+        self.assertEqual(intVal, 1234)
+        self.assertEqual(floatVal, 1234.56789)
+        self.assertEqual(floatVal2, 6.45161290322581e+46)
+        self.assertEqual(bigFloat, Decimal(
+            "12345678901234567890123456789123456789.789"))
+        self.assertEqual(bigInt, Decimal(
+            "12345678901234567890123456789123456789"))
+        self.assertEqual(boolVal, True)
+        self.assertTrue(math.isnan(nanVal))
+        self.assertTrue(math.isinf(infpVal))
+        self.assertTrue(math.isinf(infnVal))
+
+    def test_vertex(self):
+
+        print("\nTesting vertex Parsing. Result : ",  end='')
+
+        vertexExp = '''{"id": 2251799813685425, "label": "Person", 
+            "properties": {"name": "Smith", "numInt":123, "numFloat": 384.23424, 
+            "bigInt":123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789::numeric, 
+            "bigFloat":123456789123456789123456789123456789.12345::numeric, 
+            "yn":true, "nullVal": null}}::vertex'''
+
+        vertex = self.parse(vertexExp)
+        self.assertEqual(vertex.id,  2251799813685425)
+        self.assertEqual(vertex.label,  "Person")
+        self.assertEqual(vertex["name"],  "Smith")
+        self.assertEqual(vertex["numInt"],  123)
+        self.assertEqual(vertex["numFloat"],  384.23424)
+        self.assertEqual(vertex["bigInt"],  Decimal(
+            "123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789"))
+        self.assertEqual(vertex["bigFloat"],  Decimal(
+            "123456789123456789123456789123456789.12345"))
+        self.assertEqual(vertex["yn"],  True)
+        self.assertEqual(vertex["nullVal"],  None)
+
+    def test_path(self):
+
+        print("\nTesting Path Parsing. Result : ",  end='')
+
+        pathExp = '''[{"id": 2251799813685425, "label": "Person", "properties": {"name": "Smith"}}::vertex, 
+            {"id": 2533274790396576, "label": "workWith", "end_id": 2251799813685425, "start_id": 2251799813685424, 
+                "properties": {"weight": 3, "bigFloat":123456789123456789123456789.12345::numeric}}::edge, 
+            {"id": 2251799813685424, "label": "Person", "properties": {"name": "Joe"}}::vertex]::path'''
+
+        path = self.parse(pathExp)
+        vertexStart = path[0]
+        edge = path[1]
+        vertexEnd = path[2]
+        self.assertEqual(vertexStart.id,  2251799813685425)
+        self.assertEqual(vertexStart.label,  "Person")
+        self.assertEqual(vertexStart["name"],  "Smith")
+
+        self.assertEqual(edge.id,  2533274790396576)
+        self.assertEqual(edge.label,  "workWith")
+        self.assertEqual(edge["weight"],  3)
+        self.assertEqual(edge["bigFloat"],  Decimal(
+            "123456789123456789123456789.12345"))
+
+        self.assertEqual(vertexEnd.id,  2251799813685424)
+        self.assertEqual(vertexEnd.label,  "Person")
+        self.assertEqual(vertexEnd["name"],  "Joe")
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/drivers/python/test_networkx.py b/drivers/python/test_networkx.py
index dbaaf866..310d2cf5 100644
--- a/drivers/python/test_networkx.py
+++ b/drivers/python/test_networkx.py
@@ -224,7 +224,7 @@ class TestAgeToNetworkx(unittest.TestCase):
         with self.assertRaises(GraphNotFound) as context:
             age_to_networkx(ag.connection, graphName=non_existing_graph)
         # Check the raised exception has the expected error message
-        self.assertIn(non_existing_graph, str(context.exception))
+        self.assertEqual(str(context.exception), non_existing_graph)
 
 
 class TestNetworkxToAGE(unittest.TestCase):
diff --git a/drivers/python/test_security.py b/drivers/python/test_security.py
deleted file mode 100644
index 01afee79..00000000
--- a/drivers/python/test_security.py
+++ /dev/null
@@ -1,274 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-"""Security tests for the Apache AGE Python driver.
-
-Tests input validation, SQL injection prevention, and exception handling.
-"""
-
-import unittest
-from age.age import (
-    validate_graph_name,
-    validate_identifier,
-    buildCypher,
-    _validate_column,
-)
-from age.exceptions import (
-    AgeNotSet,
-    GraphNotFound,
-    GraphAlreadyExists,
-    GraphNotSet,
-    InvalidGraphName,
-    InvalidIdentifier,
-)
-
-
-class TestGraphNameValidation(unittest.TestCase):
-    """Test validate_graph_name rejects dangerous inputs."""
-
-    def test_rejects_empty_string(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('')
-
-    def test_rejects_none(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name(None)
-
-    def test_rejects_non_string(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name(123)
-
-    def test_rejects_digit_start(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('123graph')
-
-    def test_rejects_sql_injection_drop_table(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name("'; DROP TABLE ag_graph; --")
-
-    def test_rejects_sql_injection_semicolon(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name("test'); DROP TABLE users; --")
-
-    def test_rejects_sql_injection_select(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name("graph; SELECT * FROM pg_shadow")
-
-    def test_accepts_hyphenated_graph_name(self):
-        # AGE allows hyphens in middle positions of graph names.
-        validate_graph_name('my-graph')
-
-    def test_rejects_space(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('my graph')
-
-    def test_accepts_dotted_graph_name(self):
-        # AGE allows dots in middle positions of graph names.
-        validate_graph_name('my.graph')
-
-    def test_rejects_dollar(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('my$graph')
-
-    def test_rejects_exceeding_63_chars(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('a' * 64)
-
-    def test_accepts_valid_names(self):
-        # These should NOT raise
-        validate_graph_name('my_graph')
-        validate_graph_name('MyGraph')
-        validate_graph_name('_pr_ivate')
-        validate_graph_name('graph123')
-        validate_graph_name('my-graph')
-        validate_graph_name('my.graph')
-        validate_graph_name('a-b.c_d')
-        validate_graph_name('abc')
-        validate_graph_name('a' * 63)
-
-    def test_rejects_shorter_than_3_chars(self):
-        # AGE requires minimum 3 character graph names.
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('a')
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('ab')
-
-    def test_rejects_name_ending_with_hyphen(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('graph-')
-
-    def test_rejects_name_ending_with_dot(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('graph.')
-
-    def test_rejects_name_starting_with_hyphen(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('-graph')
-
-    def test_rejects_name_starting_with_dot(self):
-        with self.assertRaises(InvalidGraphName):
-            validate_graph_name('.graph')
-
-    def test_error_message_contains_name(self):
-        try:
-            validate_graph_name("bad;name")
-            self.fail("Expected InvalidGraphName")
-        except InvalidGraphName as e:
-            self.assertIn("bad;name", str(e))
-            self.assertIn("Invalid graph name", str(e))
-
-
-class TestIdentifierValidation(unittest.TestCase):
-    """Test validate_identifier rejects dangerous inputs."""
-
-    def test_rejects_empty_string(self):
-        with self.assertRaises(InvalidIdentifier):
-            validate_identifier('')
-
-    def test_rejects_none(self):
-        with self.assertRaises(InvalidIdentifier):
-            validate_identifier(None)
-
-    def test_rejects_sql_injection(self):
-        with self.assertRaises(InvalidIdentifier):
-            validate_identifier("Person'; DROP TABLE--")
-
-    def test_rejects_special_chars(self):
-        with self.assertRaises(InvalidIdentifier):
-            validate_identifier("col; DROP TABLE")
-
-    def test_accepts_valid_identifiers(self):
-        validate_identifier('Person')
-        validate_identifier('KNOWS')
-        validate_identifier('_internal')
-        validate_identifier('col1')
-
-    def test_error_includes_context(self):
-        try:
-            validate_identifier("bad;name", "Column name")
-            self.fail("Expected InvalidIdentifier")
-        except InvalidIdentifier as e:
-            self.assertIn("Column name", str(e))
-
-
-class TestColumnValidation(unittest.TestCase):
-    """Test _validate_column prevents injection through column specs."""
-
-    def test_plain_column_name(self):
-        self.assertEqual(_validate_column('v'), '"v" agtype')
-
-    def test_column_with_type(self):
-        self.assertEqual(_validate_column('n agtype'), '"n" agtype')
-
-    def test_empty_column(self):
-        self.assertEqual(_validate_column(''), '')
-        self.assertEqual(_validate_column('  '), '')
-
-    def test_rejects_injection_in_column_name(self):
-        with self.assertRaises(InvalidIdentifier):
-            _validate_column("v); DROP TABLE ag_graph; --")
-
-    def test_rejects_injection_in_column_type(self):
-        with self.assertRaises(InvalidIdentifier):
-            _validate_column("v agtype); DROP TABLE")
-
-    def test_rejects_three_part_column(self):
-        with self.assertRaises(InvalidIdentifier):
-            _validate_column("a b c")
-
-    def test_rejects_semicolon_in_name(self):
-        with self.assertRaises(InvalidIdentifier):
-            _validate_column("col;")
-
-
-class TestBuildCypher(unittest.TestCase):
-    """Test buildCypher validates columns and rejects injection."""
-
-    def test_default_column(self):
-        result = buildCypher('test_graph', 'MATCH (n) RETURN n', None)
-        self.assertIn('"v" agtype', result)
-
-    def test_single_column(self):
-        result = buildCypher('test_graph', 'MATCH (n) RETURN n', ['n'])
-        self.assertIn('"n" agtype', result)
-
-    def test_typed_column(self):
-        result = buildCypher('test_graph', 'MATCH (n) RETURN n', ['n agtype'])
-        self.assertIn('"n" agtype', result)
-
-    def test_multiple_columns(self):
-        result = buildCypher('test_graph', 'MATCH (n) RETURN n', ['a', 'b'])
-        self.assertIn('"a" agtype', result)
-        self.assertIn('"b" agtype', result)
-
-    def test_rejects_injection_in_column(self):
-        with self.assertRaises(InvalidIdentifier):
-            buildCypher('test_graph', 'MATCH (n) RETURN n',
-                        ["v); DROP TABLE ag_graph;--"])
-
-    def test_rejects_none_graph_name(self):
-        with self.assertRaises(GraphNotSet):
-            buildCypher(None, 'MATCH (n) RETURN n', None)
-
-
-class TestExceptionConstructors(unittest.TestCase):
-    """Test that exception constructors work correctly."""
-
-    def test_age_not_set_no_args(self):
-        """AgeNotSet() must work without arguments (previously crashed)."""
-        e = AgeNotSet()
-        self.assertIsNone(e.name)
-        self.assertIn('not set', repr(e))
-
-    def test_age_not_set_with_message(self):
-        e = AgeNotSet("custom message")
-        self.assertEqual(e.name, "custom message")
-
-    def test_graph_not_found_no_args(self):
-        e = GraphNotFound()
-        self.assertIsNone(e.name)
-        self.assertIn('does not exist', repr(e))
-
-    def test_graph_not_found_with_name(self):
-        e = GraphNotFound("test_graph")
-        self.assertEqual(e.name, "test_graph")
-        self.assertIn('test_graph', repr(e))
-
-    def test_graph_already_exists_no_args(self):
-        e = GraphAlreadyExists()
-        self.assertIsNone(e.name)
-        self.assertIn('already exists', repr(e))
-
-    def test_graph_already_exists_with_name(self):
-        e = GraphAlreadyExists("test_graph")
-        self.assertEqual(e.name, "test_graph")
-        self.assertIn('test_graph', repr(e))
-
-    def test_invalid_graph_name_fields(self):
-        e = InvalidGraphName("bad;name", "must be valid")
-        self.assertEqual(e.name, "bad;name")
-        self.assertEqual(e.reason, "must be valid")
-        self.assertIn("bad;name", str(e))
-        self.assertIn("must be valid", str(e))
-
-    def test_invalid_identifier_fields(self):
-        e = InvalidIdentifier("col;drop", "Column name")
-        self.assertEqual(e.name, "col;drop")
-        self.assertEqual(e.context, "Column name")
-        self.assertIn("col;drop", str(e))
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/regress/age_load/data/bad_delim_edges.csv b/regress/age_load/data/bad_delim_edges.csv
deleted file mode 100644
index c72170a6..00000000
--- a/regress/age_load/data/bad_delim_edges.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-start_id|start_vertex_type|end_id|end_vertex_type
-1|V|2|V
diff --git a/regress/age_load/data/edges_long_row.csv b/regress/age_load/data/edges_long_row.csv
deleted file mode 100644
index 2036f534..00000000
--- a/regress/age_load/data/edges_long_row.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-start_id,start_vertex_type,end_id,end_vertex_type
-1,V,2,V,extra
diff --git a/regress/age_load/data/edges_short_row.csv b/regress/age_load/data/edges_short_row.csv
deleted file mode 100644
index e307927b..00000000
--- a/regress/age_load/data/edges_short_row.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-start_id,start_vertex_type,end_id,end_vertex_type
-1,V
diff --git a/regress/age_load/data/labels_long_row.csv b/regress/age_load/data/labels_long_row.csv
deleted file mode 100644
index 72ec2a30..00000000
--- a/regress/age_load/data/labels_long_row.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-id,name
-1,Alice,extra
diff --git a/regress/expected/age_global_graph.out b/regress/expected/age_global_graph.out
index 4833511a..f2d9b059 100644
--- a/regress/expected/age_global_graph.out
+++ b/regress/expected/age_global_graph.out
@@ -44,36 +44,27 @@ SELECT * FROM cypher('ag_graph_3', $$ CREATE (v:vertex3) RETURN v  $$) AS (v agt
 (1 row)
 
 -- load contexts using the vertex_stats command
--- Build all three graph contexts under one snapshot. The vertex_stats()
--- calls are wrapped in a single REPEATABLE READ transaction so they share
--- one snapshot; this keeps the snapshot-fallback path in is_ggctx_invalid()
--- from purging an already-built context when concurrent xid activity
--- (autovacuum, parallel installcheck, replication) advances the snapshot
--- between calls. Read Committed is insufficient: it takes a fresh snapshot
--- per statement.
-BEGIN ISOLATION LEVEL REPEATABLE READ;
-SELECT * FROM cypher('ag_graph_3', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_3', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 844424930131969, "label": "vertex3", "in_degree": 0, "out_degree": 0, "self_loops": 0}
 (1 row)
 
-SELECT * FROM cypher('ag_graph_2', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_2', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 844424930131969, "label": "vertex2", "in_degree": 0, "out_degree": 0, "self_loops": 0}
 (1 row)
 
-SELECT * FROM cypher('ag_graph_1', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_1', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 844424930131969, "label": "vertex1", "in_degree": 0, "out_degree": 0, "self_loops": 0}
 (1 row)
 
-COMMIT;
 --- loading undefined contexts
 --- should throw exception - graph "ag_graph_4" does not exist
-SELECT * FROM cypher('ag_graph_4', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_4', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype);
 ERROR:  graph "ag_graph_4" does not exist
 LINE 1: SELECT * FROM cypher('ag_graph_4', $$ MATCH (u) RETURN verte...
                              ^
@@ -139,28 +130,24 @@ LINE 1: SELECT * FROM cypher('ag_graph_4', $$ RETURN delete_global_g...
 -- delete_GRAPH_global_contexts
 --
 -- load contexts again
--- Same REPEATABLE READ wrap as the first build phase above, for the same
--- snapshot-stability reason.
-BEGIN ISOLATION LEVEL REPEATABLE READ;
-SELECT * FROM cypher('ag_graph_3', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_3', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 844424930131969, "label": "vertex3", "in_degree": 0, "out_degree": 0, "self_loops": 0}
 (1 row)
 
-SELECT * FROM cypher('ag_graph_2', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_2', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 844424930131969, "label": "vertex2", "in_degree": 0, "out_degree": 0, "self_loops": 0}
 (1 row)
 
-SELECT * FROM cypher('ag_graph_1', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_1', $$ MATCH (u) RETURN vertex_stats(u) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 844424930131969, "label": "vertex1", "in_degree": 0, "out_degree": 0, "self_loops": 0}
 (1 row)
 
-COMMIT;
 -- delete all graph contexts
 -- should return true
 SELECT * FROM cypher('ag_graph_1', $$ RETURN delete_global_graphs(NULL) $$) AS (result agtype);
@@ -206,14 +193,14 @@ SELECT * FROM cypher('ag_graph_2', $$ CREATE (:Person) $$) as (v agtype);
 (0 rows)
 
 ---adding edges between nodes
-SELECT * FROM cypher('ag_graph_2', $$ MATCH (a:Person), (b:Person) WHERE a.name = 'A' AND b.name = 'B' CREATE (a)-[e:RELTYPE]->(b) RETURN e ORDER BY id(e) $$) as (e agtype);
+SELECT * FROM cypher('ag_graph_2', $$ MATCH (a:Person), (b:Person) WHERE a.name = 'A' AND b.name = 'B' CREATE (a)-[e:RELTYPE]->(b) RETURN e $$) as (e agtype);
  e 
 ---
 (0 rows)
 
 --checking if vertex stats have been updated along with the new label
 --should return 3 vertices
-SELECT * FROM cypher('ag_graph_1', $$ MATCH (n) RETURN vertex_stats(n) ORDER BY id(n) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_1', $$ MATCH (n) RETURN vertex_stats(n) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 281474976710657, "label": "", "in_degree": 0, "out_degree": 0, "self_loops": 0}
@@ -222,7 +209,7 @@ SELECT * FROM cypher('ag_graph_1', $$ MATCH (n) RETURN vertex_stats(n) ORDER BY
 (3 rows)
 
 --should return 1 vertice and 1 label
-SELECT * FROM cypher('ag_graph_2', $$ MATCH (a) RETURN vertex_stats(a) ORDER BY id(a) $$) AS (result agtype);
+SELECT * FROM cypher('ag_graph_2', $$ MATCH (a) RETURN vertex_stats(a) $$) AS (result agtype);
                                             result                                             
 -----------------------------------------------------------------------------------------------
  {"id": 844424930131969, "label": "vertex2", "in_degree": 0, "out_degree": 0, "self_loops": 0}
@@ -284,7 +271,7 @@ SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[]->(v) SET u.id = id(u)
                                                         SET v.id = id(v)
                                                         SET u.name = 'u'
                                                         SET v.name = 'v'
-                                      RETURN u,v ORDER BY id(u), id(v) $$) AS (u agtype, v agtype);
+                                      RETURN u,v $$) AS (u agtype, v agtype);
                                                 u                                                 |                                                v                                                 
 --------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------
  {"id": 281474976710659, "label": "", "properties": {"id": 281474976710659, "name": "u"}}::vertex | {"id": 281474976710660, "label": "", "properties": {"id": 281474976710660, "name": "v"}}::vertex
@@ -298,17 +285,17 @@ SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[]->(v) MERGE (v)-[:stalks]->(u)
 --------
 (0 rows)
 
-SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[e]->(v) RETURN u, e, v ORDER BY id(e) $$) AS (u agtype, e agtype, v agtype);
+SELECT * FROM cypher('ag_graph_1', $$ MATCH (u)-[e]->(v) RETURN u, e, v $$) AS (u agtype, e agtype, v agtype);
                                                 u                                                 |                                                              e                                                              |                                                v                                                 
 --------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------
- {"id": 281474976710659, "label": "", "properties": {"id": 281474976710659, "name": "u"}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge  | {"id": 281474976710660, "label": "", "properties": {"id": 281474976710660, "name": "v"}}::vertex
- {"id": 281474976710661, "label": "", "properties": {"id": 281474976710661, "name": "u"}}::vertex | {"id": 1125899906842626, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge  | {"id": 281474976710662, "label": "", "properties": {"id": 281474976710662, "name": "v"}}::vertex
- {"id": 281474976710663, "label": "", "properties": {"id": 281474976710663, "name": "u"}}::vertex | {"id": 1125899906842627, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge  | {"id": 281474976710664, "label": "", "properties": {"id": 281474976710664, "name": "v"}}::vertex
- {"id": 281474976710665, "label": "", "properties": {"id": 281474976710665, "name": "u"}}::vertex | {"id": 1125899906842628, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge  | {"id": 281474976710666, "label": "", "properties": {"id": 281474976710666, "name": "v"}}::vertex
  {"id": 281474976710660, "label": "", "properties": {"id": 281474976710660, "name": "v"}}::vertex | {"id": 1407374883553281, "label": "stalks", "end_id": 281474976710659, "start_id": 281474976710660, "properties": {}}::edge | {"id": 281474976710659, "label": "", "properties": {"id": 281474976710659, "name": "u"}}::vertex
+ {"id": 281474976710659, "label": "", "properties": {"id": 281474976710659, "name": "u"}}::vertex | {"id": 1125899906842625, "label": "knows", "end_id": 281474976710660, "start_id": 281474976710659, "properties": {}}::edge  | {"id": 281474976710660, "label": "", "properties": {"id": 281474976710660, "name": "v"}}::vertex
  {"id": 281474976710662, "label": "", "properties": {"id": 281474976710662, "name": "v"}}::vertex | {"id": 1407374883553282, "label": "stalks", "end_id": 281474976710661, "start_id": 281474976710662, "properties": {}}::edge | {"id": 281474976710661, "label": "", "properties": {"id": 281474976710661, "name": "u"}}::vertex
+ {"id": 281474976710661, "label": "", "properties": {"id": 281474976710661, "name": "u"}}::vertex | {"id": 1125899906842626, "label": "knows", "end_id": 281474976710662, "start_id": 281474976710661, "properties": {}}::edge  | {"id": 281474976710662, "label": "", "properties": {"id": 281474976710662, "name": "v"}}::vertex
  {"id": 281474976710664, "label": "", "properties": {"id": 281474976710664, "name": "v"}}::vertex | {"id": 1407374883553283, "label": "stalks", "end_id": 281474976710663, "start_id": 281474976710664, "properties": {}}::edge | {"id": 281474976710663, "label": "", "properties": {"id": 281474976710663, "name": "u"}}::vertex
+ {"id": 281474976710663, "label": "", "properties": {"id": 281474976710663, "name": "u"}}::vertex | {"id": 1125899906842627, "label": "knows", "end_id": 281474976710664, "start_id": 281474976710663, "properties": {}}::edge  | {"id": 281474976710664, "label": "", "properties": {"id": 281474976710664, "name": "v"}}::vertex
  {"id": 281474976710666, "label": "", "properties": {"id": 281474976710666, "name": "v"}}::vertex | {"id": 1407374883553284, "label": "stalks", "end_id": 281474976710665, "start_id": 281474976710666, "properties": {}}::edge | {"id": 281474976710665, "label": "", "properties": {"id": 281474976710665, "name": "u"}}::vertex
+ {"id": 281474976710665, "label": "", "properties": {"id": 281474976710665, "name": "u"}}::vertex | {"id": 1125899906842628, "label": "knows", "end_id": 281474976710666, "start_id": 281474976710665, "properties": {}}::edge  | {"id": 281474976710666, "label": "", "properties": {"id": 281474976710666, "name": "v"}}::vertex
 (8 rows)
 
 -- what is there now?
@@ -319,7 +306,7 @@ SELECT * FROM cypher('ag_graph_1', $$ RETURN graph_stats('ag_graph_1') $$) AS (r
 (1 row)
 
 -- remove some vertices
-SELECT * FROM ag_graph_1._ag_label_vertex ORDER BY id;
+SELECT * FROM ag_graph_1._ag_label_vertex;
        id        |              properties              
 -----------------+--------------------------------------
  281474976710657 | {}
@@ -338,7 +325,7 @@ SELECT * FROM ag_graph_1._ag_label_vertex ORDER BY id;
 DELETE FROM ag_graph_1._ag_label_vertex WHERE id::text = '281474976710661';
 DELETE FROM ag_graph_1._ag_label_vertex WHERE id::text = '281474976710662';
 DELETE FROM ag_graph_1._ag_label_vertex WHERE id::text = '281474976710664';
-SELECT * FROM ag_graph_1._ag_label_vertex ORDER BY id;
+SELECT * FROM ag_graph_1._ag_label_vertex;
        id        |              properties              
 -----------------+--------------------------------------
  281474976710657 | {}
@@ -351,7 +338,7 @@ SELECT * FROM ag_graph_1._ag_label_vertex ORDER BY id;
  844424930131969 | {}
 (8 rows)
 
-SELECT * FROM ag_graph_1._ag_label_edge ORDER BY id;
+SELECT * FROM ag_graph_1._ag_label_edge;
         id        |    start_id     |     end_id      | properties 
 ------------------+-----------------+-----------------+------------
  1125899906842625 | 281474976710659 | 281474976710660 | {}
@@ -364,30 +351,21 @@ SELECT * FROM ag_graph_1._ag_label_edge ORDER BY id;
  1407374883553284 | 281474976710666 | 281474976710665 | {}
 (8 rows)
 
--- The graph_stats query below will produce warnings for the dangling edges
--- created by the DELETE commands above. The warnings appear in nondeterministic
--- order because they come from iterating edge label tables (knows, stalks),
--- so we suppress them with client_min_messages. Without suppression, the
--- output would include these warnings (in some order):
---
--- WARNING:  edge: [id: 1125899906842626, start: 281474976710661, end: 281474976710662, label: knows] start and end vertices not found
--- WARNING:  ignored malformed or dangling edge
--- WARNING:  edge: [id: 1125899906842627, start: 281474976710663, end: 281474976710664, label: knows] end vertex not found
--- WARNING:  ignored malformed or dangling edge
--- WARNING:  edge: [id: 1407374883553282, start: 281474976710662, end: 281474976710661, label: stalks] start and end vertices not found
--- WARNING:  ignored malformed or dangling edge
--- WARNING:  edge: [id: 1407374883553283, start: 281474976710664, end: 281474976710663, label: stalks] start vertex not found
--- WARNING:  ignored malformed or dangling edge
---
--- The result row validates that graph_stats handled the dangling edges correctly.
-SET client_min_messages = error;
+-- there should be warning messages
 SELECT * FROM cypher('ag_graph_1', $$ RETURN graph_stats('ag_graph_1') $$) AS (result agtype);
+WARNING:  edge: [id: 1125899906842626, start: 281474976710661, end: 281474976710662, label: knows] start and end vertices not found
+WARNING:  ignored malformed or dangling edge
+WARNING:  edge: [id: 1125899906842627, start: 281474976710663, end: 281474976710664, label: knows] end vertex not found
+WARNING:  ignored malformed or dangling edge
+WARNING:  edge: [id: 1407374883553282, start: 281474976710662, end: 281474976710661, label: stalks] start and end vertices not found
+WARNING:  ignored malformed or dangling edge
+WARNING:  edge: [id: 1407374883553283, start: 281474976710664, end: 281474976710663, label: stalks] start vertex not found
+WARNING:  ignored malformed or dangling edge
                                   result                                  
 --------------------------------------------------------------------------
  {"graph": "ag_graph_1", "num_loaded_edges": 8, "num_loaded_vertices": 8}
 (1 row)
 
-RESET client_min_messages;
 --drop graphs
 SELECT * FROM drop_graph('ag_graph_1', true);
 NOTICE:  drop cascades to 5 other objects
@@ -426,294 +404,6 @@ NOTICE:  graph "ag_graph_3" has been dropped
  
 (1 row)
 
------------------------------------------------------------------------------------------------------------------------------
---
--- VLE cache invalidation tests
---
--- These tests verify that the graph version counter properly invalidates
--- the VLE hash table cache when the graph is mutated, and that thin
--- entry lazy property fetch returns correct data.
---
--- Setup: create a graph with a chain a->b->c->d
-SELECT * FROM create_graph('vle_cache_test');
-NOTICE:  graph "vle_cache_test" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT * FROM cypher('vle_cache_test', $$
-  CREATE (a:Node {name: 'a'})-[:Edge]->(b:Node {name: 'b'})-[:Edge]->(c:Node {name: 'c'})-[:Edge]->(d:Node {name: 'd'})
-$$) AS (v agtype);
- v 
----
-(0 rows)
-
--- VLE query: find all paths from a's neighbors (should find b, b->c, b->c->d)
-SELECT * FROM cypher('vle_cache_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..3]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
- name 
-------
- "b"
- "c"
- "d"
-(3 rows)
-
--- Now add a new node e connected to d. This should invalidate the cache.
-SELECT * FROM cypher('vle_cache_test', $$
-  MATCH (d:Node {name: 'd'})
-  CREATE (d)-[:Edge]->(:Node {name: 'e'})
-$$) AS (v agtype);
- v 
----
-(0 rows)
-
--- VLE query again: should now also find e via a->b->c->d->e (4 hops won't reach,
--- but d->e is 1 hop from d, and a->b->c->d->e would be 4 hops from a).
--- Increase range to *1..4 to include e
-SELECT * FROM cypher('vle_cache_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..4]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
- name 
-------
- "b"
- "c"
- "d"
- "e"
-(4 rows)
-
--- Test cache invalidation on DELETE: remove node c and its edges
-SELECT * FROM cypher('vle_cache_test', $$
-  MATCH (c:Node {name: 'c'})
-  DETACH DELETE c
-$$) AS (v agtype);
- v 
----
-(0 rows)
-
--- VLE query: should only find b now (c is gone, so b->c path is broken)
-SELECT * FROM cypher('vle_cache_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..4]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
- name 
-------
- "b"
-(1 row)
-
--- Test cache invalidation on SET: change b's name property
-SELECT * FROM cypher('vle_cache_test', $$
-  MATCH (b:Node {name: 'b'})
-  SET b.name = 'b_modified'
-  RETURN b.name
-$$) AS (name agtype);
-     name     
---------------
- "b_modified"
-(1 row)
-
--- VLE query: verify the updated property is returned via lazy fetch
-SELECT * FROM cypher('vle_cache_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..4]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
-     name     
---------------
- "b_modified"
-(1 row)
-
--- Test VLE with edge properties (exercises thin entry edge property fetch)
-SELECT * FROM drop_graph('vle_cache_test', true);
-NOTICE:  drop cascades to 4 other objects
-DETAIL:  drop cascades to table vle_cache_test._ag_label_vertex
-drop cascades to table vle_cache_test._ag_label_edge
-drop cascades to table vle_cache_test."Node"
-drop cascades to table vle_cache_test."Edge"
-NOTICE:  graph "vle_cache_test" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
-SELECT * FROM create_graph('vle_cache_test2');
-NOTICE:  graph "vle_cache_test2" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT * FROM cypher('vle_cache_test2', $$
-  CREATE (a:N {name: 'a'})-[:E {weight: 1}]->(b:N {name: 'b'})-[:E {weight: 2}]->(c:N {name: 'c'})
-$$) AS (v agtype);
- v 
----
-(0 rows)
-
--- VLE path output to verify edge properties are fetched correctly via
--- thin entry lazy fetch. Returning the full path forces build_path()
--- to call get_edge_entry_properties() for each edge in the result.
--- The output must contain the correct weight values (1 and 2).
-SELECT * FROM cypher('vle_cache_test2', $$
-  MATCH p=(a:N {name: 'a'})-[:E *1..2]->(n:N)
-  RETURN p
-  ORDER BY n.name
-$$) AS (p agtype);
-                                                                                                                                                                                                                                                        p                                                                                                                                                                                                                                                         
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "N", "properties": {"name": "a"}}::vertex, {"id": 1125899906842626, "label": "E", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {"weight": 1}}::edge, {"id": 844424930131970, "label": "N", "properties": {"name": "b"}}::vertex]::path
- [{"id": 844424930131969, "label": "N", "properties": {"name": "a"}}::vertex, {"id": 1125899906842626, "label": "E", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {"weight": 1}}::edge, {"id": 844424930131970, "label": "N", "properties": {"name": "b"}}::vertex, {"id": 1125899906842625, "label": "E", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {"weight": 2}}::edge, {"id": 844424930131971, "label": "N", "properties": {"name": "c"}}::vertex]::path
-(2 rows)
-
--- VLE edge properties via UNWIND + relationships() to individually verify
--- each edge's properties are correctly fetched from the heap via TID.
-SELECT * FROM cypher('vle_cache_test2', $$
-  MATCH p=(a:N {name: 'a'})-[:E *1..2]->(n:N)
-  WITH p, n
-  UNWIND relationships(p) AS e
-  RETURN n.name, e.weight
-  ORDER BY n.name, e.weight
-$$) AS (name agtype, weight agtype);
- name | weight 
-------+--------
- "b"  | 1
- "c"  | 1
- "c"  | 2
-(3 rows)
-
--- Cleanup
-SELECT * FROM drop_graph('vle_cache_test2', true);
-NOTICE:  drop cascades to 4 other objects
-DETAIL:  drop cascades to table vle_cache_test2._ag_label_vertex
-drop cascades to table vle_cache_test2._ag_label_edge
-drop cascades to table vle_cache_test2."N"
-drop cascades to table vle_cache_test2."E"
-NOTICE:  graph "vle_cache_test2" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
------------------------------------------------------------------------------------------------------------------------------
---
--- VLE cache invalidation via direct SQL (trigger tests)
---
--- These tests verify that the SQL trigger (age_invalidate_graph_cache)
--- properly invalidates the VLE cache when label tables are mutated
--- via direct SQL INSERT, UPDATE, DELETE, and TRUNCATE — not via Cypher.
---
--- Setup: create graph with a chain a->b->c using Cypher
-SELECT * FROM create_graph('vle_trigger_test');
-NOTICE:  graph "vle_trigger_test" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT * FROM cypher('vle_trigger_test', $$
-  CREATE (a:Node {name: 'a'})-[:Edge]->(b:Node {name: 'b'})-[:Edge]->(c:Node {name: 'c'})
-$$) AS (v agtype);
- v 
----
-(0 rows)
-
--- Prime the VLE cache: find all nodes reachable from a
-SELECT * FROM cypher('vle_trigger_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..3]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
- name 
-------
- "b"
- "c"
-(2 rows)
-
--- Direct SQL INSERT on vertex: add a new vertex via SQL.
--- This should fire the trigger and invalidate the VLE cache.
--- Use _graphid() with the label's id and nextval for the entry id.
-INSERT INTO vle_trigger_test."Node" (id, properties)
-SELECT ag_catalog._graphid(l.id,
-           nextval('vle_trigger_test."Node_id_seq"'::regclass)),
-       '{"name": "d"}'::agtype
-FROM ag_catalog.ag_label l
-JOIN ag_catalog.ag_graph g ON g.graphid = l.graph
-WHERE g.name = 'vle_trigger_test' AND l.name = 'Node';
--- VLE query: results should be unchanged (d has no edges) but cache was rebuilt
-SELECT * FROM cypher('vle_trigger_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..3]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
- name 
-------
- "b"
- "c"
-(2 rows)
-
--- Direct SQL UPDATE on vertex: change b's name to 'b_updated'
--- This should fire the trigger and invalidate the VLE cache.
-UPDATE vle_trigger_test."Node"
-SET properties = '{"name": "b_updated"}'::agtype
-WHERE properties @> '{"name": "b"}'::agtype;
--- VLE query: verify updated property is visible (cache invalidated by trigger)
-SELECT * FROM cypher('vle_trigger_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..3]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
-    name     
--------------
- "b_updated"
- "c"
-(2 rows)
-
--- Direct SQL DELETE on edge: remove the edge from b_updated to c
-DELETE FROM vle_trigger_test."Edge"
-WHERE end_id = (SELECT id FROM vle_trigger_test."Node"
-                WHERE properties @> '{"name": "c"}'::agtype);
--- VLE query: only b_updated reachable now (edge to c is gone)
-SELECT * FROM cypher('vle_trigger_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..3]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
-    name     
--------------
- "b_updated"
-(1 row)
-
--- Direct SQL TRUNCATE on edge table: remove all edges
-TRUNCATE vle_trigger_test."Edge";
--- VLE query: no edges exist, should return no rows
-SELECT * FROM cypher('vle_trigger_test', $$
-  MATCH (a:Node {name: 'a'})-[:Edge*1..3]->(n:Node)
-  RETURN n.name
-  ORDER BY n.name
-$$) AS (name agtype);
- name 
-------
-(0 rows)
-
--- Cleanup
-SELECT * FROM drop_graph('vle_trigger_test', true);
-NOTICE:  drop cascades to 4 other objects
-DETAIL:  drop cascades to table vle_trigger_test._ag_label_vertex
-drop cascades to table vle_trigger_test._ag_label_edge
-drop cascades to table vle_trigger_test."Node"
-drop cascades to table vle_trigger_test."Edge"
-NOTICE:  graph "vle_trigger_test" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
 -----------------------------------------------------------------------------------------------------------------------------
 --
 -- End of tests
diff --git a/regress/expected/age_load.out b/regress/expected/age_load.out
index 17c5ecc2..b638e636 100644
--- a/regress/expected/age_load.out
+++ b/regress/expected/age_load.out
@@ -16,9 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-\! rm -rf /tmp/age/age_load
-\! mkdir -p /tmp/age
-\! cp -r regress/age_load/data /tmp/age/age_load
+\! cp -r regress/age_load/data regress/instance/data/age_load
 LOAD 'age';
 SET search_path TO ag_catalog;
 -- Create a country using CREATE clause
@@ -45,6 +43,13 @@ SELECT load_labels_from_file('agload_test_graph', 'Country',
  
 (1 row)
 
+-- A temporary table should have been created with 54 ids; 1 from CREATE and 53 from file
+SELECT COUNT(*)=54 FROM "_agload_test_graph_ag_vertex_ids";
+ ?column? 
+----------
+ t
+(1 row)
+
 -- Sequence should be equal to max entry id i.e. 248
 SELECT currval('agload_test_graph."Country_id_seq"')=248;
  ?column? 
@@ -69,6 +74,13 @@ NOTICE:  VLabel "City" has been created
  
 (1 row)
 
+-- Temporary table should have 54+72485 rows now
+SELECT COUNT(*)=54+72485 FROM "_agload_test_graph_ag_vertex_ids";
+ ?column? 
+----------
+ t
+(1 row)
+
 -- Sequence should be equal to max entry id i.e. 146941
 SELECT currval('agload_test_graph."City_id_seq"')=146941;
  ?column? 
@@ -403,43 +415,6 @@ SELECT * FROM cypher('agload_conversion', $$ MATCH ()-[e:Edges2]->() RETURN prop
  {"bool": "false", "string": "nUll", "numeric": "3.14"}
 (6 rows)
 
---
--- Check sandbox
---
--- check null file name
-SELECT load_labels_from_file('agload_conversion', 'Person1', NULL, true, true);
-ERROR:  file path must not be NULL
-SELECT load_edges_from_file('agload_conversion', 'Edges1', NULL, true);
-ERROR:  file path must not be NULL
--- check no file name
-SELECT load_labels_from_file('agload_conversion', 'Person1', '', true, true);
-ERROR:  file name cannot be zero length
-SELECT load_edges_from_file('agload_conversion', 'Edges1', '', true);
-ERROR:  file name cannot be zero length
--- check for file/path does not exist
-SELECT load_labels_from_file('agload_conversion', 'Person1', 'age_load_xxx/conversion_vertices.csv', true, true);
-ERROR:  File or path does not exist [/tmp/age/age_load_xxx/conversion_vertices.csv]
-SELECT load_edges_from_file('agload_conversion', 'Edges1', 'age_load_xxx/conversion_edges.csv', true);
-ERROR:  File or path does not exist [/tmp/age/age_load_xxx/conversion_edges.csv]
-SELECT load_labels_from_file('agload_conversion', 'Person1', 'age_load/conversion_vertices.txt', true, true);
-ERROR:  File or path does not exist [/tmp/age/age_load/conversion_vertices.txt]
-SELECT load_edges_from_file('agload_conversion', 'Edges1', 'age_load/conversion_edges.txt', true);
-ERROR:  File or path does not exist [/tmp/age/age_load/conversion_edges.txt]
--- check wrong extension
-\! touch /tmp/age/age_load/conversion_vertices.txt
-\! touch /tmp/age/age_load/conversion_edges.txt
-SELECT load_labels_from_file('agload_conversion', 'Person1', 'age_load/conversion_vertices.txt', true, true);
-ERROR:  You can only load files with extension [.csv].
-SELECT load_edges_from_file('agload_conversion', 'Edges1', 'age_load/conversion_edges.txt', true);
-ERROR:  You can only load files with extension [.csv].
--- check outside sandbox directory
-SELECT load_labels_from_file('agload_conversion', 'Person1', '../../etc/passwd', true, true);
-ERROR:  You can only load files located in [/tmp/age/].
-SELECT load_edges_from_file('agload_conversion', 'Edges1', '../../etc/passwd', true);
-ERROR:  You can only load files located in [/tmp/age/].
---
--- Cleanup
---
 SELECT drop_graph('agload_conversion', true);
 NOTICE:  drop cascades to 6 other objects
 DETAIL:  drop cascades to table agload_conversion._ag_label_vertex
@@ -454,252 +429,3 @@ NOTICE:  graph "agload_conversion" has been dropped
  
 (1 row)
 
---
--- Issue 2449: mis-delimited / malformed load files must fail with a clear
--- error instead of segfaulting or silently corrupting data. Edge files
--- require the 4 fixed columns; a file that is not comma-delimited parses as
--- a single column, so this must be rejected at the header.
---
-SELECT create_graph('agload_delim');
-NOTICE:  graph "agload_delim" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT create_vlabel('agload_delim', 'V');
-NOTICE:  VLabel "V" has been created
- create_vlabel 
----------------
- 
-(1 row)
-
-SELECT create_elabel('agload_delim', 'E');
-NOTICE:  ELabel "E" has been created
- create_elabel 
----------------
- 
-(1 row)
-
--- pipe-delimited edge file -> parses to 1 column -> clean error at the header
--- (was a segfault)
-SELECT load_edges_from_file('agload_delim', 'E', 'age_load/bad_delim_edges.csv');
-ERROR:  edge file must have at least 4 columns (start_id, start_vertex_type, end_id, end_vertex_type), but the header has 1
-HINT:  load_edges_from_file expects a comma-delimited CSV; check the file's delimiter.
--- per-row guards (header is valid, but an individual data row is ragged):
--- an edge row with fewer than 4 columns -> clean error (was an OOB read of
--- the fixed fields[1..3])
-SELECT load_edges_from_file('agload_delim', 'E', 'age_load/edges_short_row.csv');
-ERROR:  edge file row has 2 columns; expected at least 4 and no more than the header's 4 columns
--- an edge row with more columns than the header -> clean error (was an OOB
--- read of header[i] in create_agtype_from_list_i)
-SELECT load_edges_from_file('agload_delim', 'E', 'age_load/edges_long_row.csv');
-ERROR:  edge file row has 5 columns; expected at least 4 and no more than the header's 4 columns
--- a label row with more columns than the header -> clean error (was an OOB
--- read of header[i] in create_agtype_from_list)
-SELECT load_labels_from_file('agload_delim', 'V', 'age_load/labels_long_row.csv');
-ERROR:  label file row has 3 columns, more than the header's 2 columns
-SELECT drop_graph('agload_delim', true);
-NOTICE:  drop cascades to 4 other objects
-DETAIL:  drop cascades to table agload_delim._ag_label_vertex
-drop cascades to table agload_delim._ag_label_edge
-drop cascades to table agload_delim."V"
-drop cascades to table agload_delim."E"
-NOTICE:  graph "agload_delim" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
---
--- Test security and permissions
---
-SELECT create_graph('agload_security');
-NOTICE:  graph "agload_security" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT create_vlabel('agload_security', 'Person1');
-NOTICE:  VLabel "Person1" has been created
- create_vlabel 
----------------
- 
-(1 row)
-
-SELECT create_vlabel('agload_security', 'Person2');
-NOTICE:  VLabel "Person2" has been created
- create_vlabel 
----------------
- 
-(1 row)
-
-SELECT create_elabel('agload_security', 'SecEdge');
-NOTICE:  ELabel "SecEdge" has been created
- create_elabel 
----------------
- 
-(1 row)
-
---
--- Test 1: File read permission (pg_read_server_files role)
---
--- Create a user without pg_read_server_files role
-CREATE USER load_test_user;
-GRANT USAGE ON SCHEMA ag_catalog TO load_test_user;
--- This should fail because load_test_user doesn't have pg_read_server_files
-SET ROLE load_test_user;
-SELECT load_labels_from_file('agload_security', 'Person1', 'age_load/conversion_vertices.csv', true);
-ERROR:  permission denied to LOAD from a file
-DETAIL:  Only roles with privileges of the "pg_read_server_files" role may LOAD from a file.
-SELECT load_edges_from_file('agload_security', 'SecEdge', 'age_load/conversion_edges.csv');
-ERROR:  permission denied to LOAD from a file
-DETAIL:  Only roles with privileges of the "pg_read_server_files" role may LOAD from a file.
-RESET ROLE;
--- Grant pg_read_server_files and try again - should fail on table permission now
-GRANT pg_read_server_files TO load_test_user;
---
--- Test 2: Table INSERT permission (ACL_INSERT)
---
--- User has file read permission but no INSERT on the label table
-SET ROLE load_test_user;
-SELECT load_labels_from_file('agload_security', 'Person1', 'age_load/conversion_vertices.csv', true);
-ERROR:  permission denied for table Person1
-SELECT load_edges_from_file('agload_security', 'SecEdge', 'age_load/conversion_edges.csv');
-ERROR:  permission denied for table SecEdge
-RESET ROLE;
--- Grant INSERT permission and try again - should succeed
-GRANT USAGE ON SCHEMA agload_security TO load_test_user;
-GRANT INSERT ON agload_security."Person1" TO load_test_user;
-GRANT INSERT ON agload_security."SecEdge" TO load_test_user;
-GRANT UPDATE ON SEQUENCE agload_security."Person1_id_seq" TO load_test_user;
-GRANT UPDATE ON SEQUENCE agload_security."SecEdge_id_seq" TO load_test_user;
-GRANT SELECT ON ag_catalog.ag_label TO load_test_user;
-GRANT SELECT ON ag_catalog.ag_graph TO load_test_user;
-SET ROLE load_test_user;
-SELECT load_labels_from_file('agload_security', 'Person1', 'age_load/conversion_vertices.csv', true);
- load_labels_from_file 
------------------------
- 
-(1 row)
-
-SELECT load_edges_from_file('agload_security', 'SecEdge', 'age_load/conversion_edges.csv');
- load_edges_from_file 
-----------------------
- 
-(1 row)
-
-RESET ROLE;
--- Verify data was loaded
-SELECT COUNT(*) FROM agload_security."Person1";
- count 
--------
-     6
-(1 row)
-
-SELECT COUNT(*) FROM agload_security."SecEdge";
- count 
--------
-     6
-(1 row)
-
--- cleanup
-DELETE FROM agload_security."Person1";
-DELETE FROM agload_security."SecEdge";
---
--- Test 3: Row-Level Security (RLS)
---
--- Enable RLS on the label tables
-ALTER TABLE agload_security."Person1" ENABLE ROW LEVEL SECURITY;
-ALTER TABLE agload_security."SecEdge" ENABLE ROW LEVEL SECURITY;
--- Switch to load_test_user
-SET ROLE load_test_user;
--- Loading should fail when RLS is enabled
-SELECT load_labels_from_file('agload_security', 'Person1', 'age_load/conversion_vertices.csv', true);
-ERROR:  LOAD from file is not supported with row-level security
-HINT:  Use Cypher CREATE clause instead.
-SELECT load_edges_from_file('agload_security', 'SecEdge', 'age_load/conversion_edges.csv');
-ERROR:  LOAD from file is not supported with row-level security
-HINT:  Use Cypher CREATE clause instead.
-RESET ROLE;
--- Disable RLS and try again - should succeed
-ALTER TABLE agload_security."Person1" DISABLE ROW LEVEL SECURITY;
-ALTER TABLE agload_security."SecEdge" DISABLE ROW LEVEL SECURITY;
-SELECT load_labels_from_file('agload_security', 'Person1', 'age_load/conversion_vertices.csv', true);
- load_labels_from_file 
------------------------
- 
-(1 row)
-
-SELECT load_edges_from_file('agload_security', 'SecEdge', 'age_load/conversion_edges.csv');
- load_edges_from_file 
-----------------------
- 
-(1 row)
-
--- Verify data was loaded
-SELECT COUNT(*) FROM agload_security."Person1";
- count 
--------
-     6
-(1 row)
-
-SELECT COUNT(*) FROM agload_security."SecEdge";
- count 
--------
-     6
-(1 row)
-
--- cleanup
-DELETE FROM agload_security."Person1";
-DELETE FROM agload_security."SecEdge";
---
--- Test 4: Constraint checking (CHECK constraint)
---
--- Add constraint on vertex properties - fail if bool property is false
-ALTER TABLE agload_security."Person1" ADD CONSTRAINT check_bool_true
-    CHECK ((properties->>'"bool"')::boolean = true);
--- This should fail - constraint violation
-SELECT load_labels_from_file('agload_security', 'Person1', 'age_load/conversion_vertices.csv', true);
-ERROR:  new row for relation "Person1" violates check constraint "check_bool_true"
-DETAIL:  Failing row contains (844424930131970, {"id": "2", "bool": "false", "__id__": 2, "string": "John", "num...).
--- Add constraint on edge properties - fail if bool property is false
-ALTER TABLE agload_security."SecEdge" ADD CONSTRAINT check_bool_true
-    CHECK ((properties->>'"bool"')::boolean = true);
--- This should fail - some edges have bool = false
-SELECT load_edges_from_file('agload_security', 'SecEdge', 'age_load/conversion_edges.csv');
-ERROR:  new row for relation "SecEdge" violates check constraint "check_bool_true"
-DETAIL:  Failing row contains (1407374883553294, 844424930131969, 1125899906842625, {"bool": "false", "string": "John", "numeric": "-2"}).
--- cleanup
-ALTER TABLE agload_security."Person1" DROP CONSTRAINT check_bool_true;
-ALTER TABLE agload_security."SecEdge" DROP CONSTRAINT check_bool_true;
---
--- Cleanup
---
-REVOKE ALL ON agload_security."Person1" FROM load_test_user;
-REVOKE ALL ON agload_security."SecEdge" FROM load_test_user;
-REVOKE ALL ON SEQUENCE agload_security."Person1_id_seq" FROM load_test_user;
-REVOKE ALL ON SEQUENCE agload_security."SecEdge_id_seq" FROM load_test_user;
-REVOKE ALL ON ag_catalog.ag_label FROM load_test_user;
-REVOKE ALL ON ag_catalog.ag_graph FROM load_test_user;
-REVOKE ALL ON SCHEMA agload_security FROM load_test_user;
-REVOKE ALL ON SCHEMA ag_catalog FROM load_test_user;
-REVOKE pg_read_server_files FROM load_test_user;
-DROP USER load_test_user;
-SELECT drop_graph('agload_security', true);
-NOTICE:  drop cascades to 5 other objects
-DETAIL:  drop cascades to table agload_security._ag_label_vertex
-drop cascades to table agload_security._ag_label_edge
-drop cascades to table agload_security."Person1"
-drop cascades to table agload_security."Person2"
-drop cascades to table agload_security."SecEdge"
-NOTICE:  graph "agload_security" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
---
--- End
---
diff --git a/regress/expected/age_reduce.out b/regress/expected/age_reduce.out
deleted file mode 100644
index 5f3bf29f..00000000
--- a/regress/expected/age_reduce.out
+++ /dev/null
@@ -1,850 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-LOAD 'age';
-SET search_path TO ag_catalog;
-SELECT create_graph('reduce');
-NOTICE:  graph "reduce" has been created
- create_graph 
---------------
- 
-(1 row)
-
---
--- Basic folds
---
--- sum
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x)
-$$) AS (result agtype);
- result 
---------
- 6
-(1 row)
-
--- sum of a longer list
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | s + x)
-$$) AS (result agtype);
- result 
---------
- 55
-(1 row)
-
--- product (factorial)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(p = 1, x IN [1, 2, 3, 4, 5] | p * x)
-$$) AS (result agtype);
- result 
---------
- 120
-(1 row)
-
--- non-zero initial accumulator
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 100, x IN [1, 2, 3] | s + x)
-$$) AS (result agtype);
- result 
---------
- 106
-(1 row)
-
--- single element
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [42] | s + x)
-$$) AS (result agtype);
- result 
---------
- 42
-(1 row)
-
---
--- List order is significant
---
--- left-associative subtraction: ((((0-1)-2)-3)-4) = -10
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3, 4] | s - x)
-$$) AS (result agtype);
- result 
---------
- -10
-(1 row)
-
--- forward string concatenation
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = '', x IN ['a', 'b', 'c'] | s + x)
-$$) AS (result agtype);
- result 
---------
- "abc"
-(1 row)
-
--- reverse string concatenation (element before accumulator)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = '', x IN ['a', 'b', 'c'] | x + s)
-$$) AS (result agtype);
- result 
---------
- "cba"
-(1 row)
-
---
--- Empty and NULL list semantics
---
--- empty list returns the initial value
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [] | s + x)
-$$) AS (result agtype);
- result 
---------
- 0
-(1 row)
-
--- empty list returns the initial value (non-zero)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 999, x IN [] | s + x)
-$$) AS (result agtype);
- result 
---------
- 999
-(1 row)
-
--- NULL list returns NULL
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN null | s + x)
-$$) AS (result agtype);
- result 
---------
- 
-(1 row)
-
--- empty list with a NULL initial value yields NULL: the list is empty (not
--- null) so the fold runs over zero rows, and COALESCE(<no rows>, init) is
--- COALESCE(NULL, NULL) -> NULL. (Distinct from a NULL *list*, which the outer
--- CASE short-circuits to NULL, and from a non-empty list with a NULL init,
--- which seeds the accumulator with agtype 'null'.)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = null, x IN [] | s + x)
-$$) AS (result agtype);
- result 
---------
- 
-(1 row)
-
---
--- NULL handling within the fold
---
--- a NULL element propagates through arithmetic to NULL
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, null, 3] | s + x)
-$$) AS (result agtype);
- result 
---------
- null
-(1 row)
-
--- NULL initial value
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = null, x IN [1, 2, 3] | s)
-$$) AS (result agtype);
- result 
---------
- null
-(1 row)
-
--- a body that always evaluates to null yields null, NOT the initial value:
--- every step stores agtype 'null' as the running state, so the final state is
--- a real agtype 'null' and the empty-list COALESCE(..., init) guard must not
--- resurrect the initial value here (the load-bearing fold-to-null vs empty-list
--- distinction)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 7, x IN [1, 2, 3] | null)
-$$) AS (result agtype);
- result 
---------
- null
-(1 row)
-
--- the accumulator legitimately becomes null mid-fold and the body climbs back
--- out of it: element 2 sets the accumulator to null, element 3 produces a fresh
--- non-null value, and element 4 reads that recovered state (999 + 4), proving a
--- null intermediate state does not poison the rest of the fold
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3, 4] |
-                  CASE WHEN x = 2 THEN null
-                       WHEN x = 3 THEN 999
-                       ELSE s + x END)
-$$) AS (result agtype);
- result 
---------
- 1003
-(1 row)
-
---
--- Errors raised from the fold body propagate cleanly
---
--- a type error in the body (agtype number + map) aborts the statement rather
--- than corrupting the running aggregate state or crashing the backend
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2] | s + {a: 1})
-$$) AS (result agtype);
-ERROR:  invalid left operand for agtype concatenation
--- a runtime arithmetic error in the body (division by zero) likewise aborts
--- the fold; the error surfaces from the standalone per-element evaluator
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 1, x IN [1, 0, 2] | s / x)
-$$) AS (result agtype);
-ERROR:  division by zero
---
--- Building a list with the accumulator
---
--- collect squares
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(acc = [], x IN [1, 2, 3] | acc + [x * x])
-$$) AS (result agtype);
-  result   
------------
- [1, 4, 9]
-(1 row)
-
---
--- Value types in the fold
---
--- a float accumulator and float elements
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0.0, x IN [1.5, 2.5, 3.0] | s + x)
-$$) AS (result agtype);
- result 
---------
- 7.0
-(1 row)
-
--- negative numbers
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [-1, -2, -3] | s + x)
-$$) AS (result agtype);
- result 
---------
- -6
-(1 row)
-
--- a map accumulator passed through unchanged
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = {n: 0}, x IN [1, 2, 3] | s)
-$$) AS (result agtype);
-  result  
-----------
- {"n": 0}
-(1 row)
-
--- elements that are themselves lists, indexed in the body
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [[1, 2], [3, 4], [5, 6]] | s + x[0])
-$$) AS (result agtype);
- result 
---------
- 9
-(1 row)
-
---
--- Function calls in the fold body
---
--- a scalar function applied to the element
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN ['a', 'bb', 'ccc'] | s + size(x))
-$$) AS (result agtype);
- result 
---------
- 6
-(1 row)
-
--- the list itself produced by a function
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN range(1, 5) | s + x)
-$$) AS (result agtype);
- result 
---------
- 15
-(1 row)
-
---
--- Composing reduce() with surrounding expressions
---
--- the reduce() result consumed by another function
-SELECT * FROM cypher('reduce', $$
-    RETURN size(reduce(s = [], x IN [1, 2, 3, 4] | s + [x]))
-$$) AS (result agtype);
- result 
---------
- 4
-(1 row)
-
--- the reduce() result used in a comparison
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x) = 6
-$$) AS (result agtype);
- result 
---------
- true
-(1 row)
-
---
--- A conditional body (CASE)
---
--- sum of even elements only
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3, 4, 5, 6] | CASE WHEN x % 2 = 0 THEN s + x ELSE s END)
-$$) AS (result agtype);
- result 
---------
- 12
-(1 row)
-
---
--- Boolean and comparison fold bodies
---
--- the body evaluates to a boolean, which is normalized to an agtype boolean
--- (a boolean accumulator is a real Cypher use case for "all"/"any" style folds)
--- logical AND fold: all true?
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = true, x IN [true, true, false] | s AND x)
-$$) AS (result agtype);
- result 
---------
- false
-(1 row)
-
--- logical OR fold: any true?
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = false, x IN [false, true, false] | s OR x)
-$$) AS (result agtype);
- result 
---------
- true
-(1 row)
-
--- a comparison body
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = false, x IN [1, 2, 3] | x = 2)
-$$) AS (result agtype);
- result 
---------
- false
-(1 row)
-
--- "does any element equal 2?" (search fold)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(found = false, x IN [1, 2, 3] | found OR x = 2)
-$$) AS (result agtype);
- result 
---------
- true
-(1 row)
-
--- "are all elements positive?" (using a comparison inside the fold)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = true, x IN [1, 2, 3] | s AND x > 0)
-$$) AS (result agtype);
- result 
---------
- true
-(1 row)
-
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = true, x IN [1, -2, 3] | s AND x > 0)
-$$) AS (result agtype);
- result 
---------
- false
-(1 row)
-
---
--- Property access on the element variable
---
--- sum a field across a list of maps
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [{n: 1}, {n: 2}, {n: 3}] | s + x.n)
-$$) AS (result agtype);
- result 
---------
- 6
-(1 row)
-
--- concatenate a string field across a list of maps
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = '', x IN [{w: 'a'}, {w: 'b'}, {w: 'c'}] | s + x.w)
-$$) AS (result agtype);
- result 
---------
- "abc"
-(1 row)
-
---
--- Multiple reduce() in one expression
---
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x) + reduce(p = 1, y IN [2, 3] | p * y)
-$$) AS (result agtype);
- result 
---------
- 12
-(1 row)
-
---
--- reduce() in a boolean expression
---
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x) > 5
-           AND reduce(p = 1, y IN [2, 3] | p * y) < 10
-$$) AS (result agtype);
- result 
---------
- true
-(1 row)
-
---
--- reduce() nested in the list or initial value of another reduce()
---
--- nesting is allowed in the list and the initial value (both evaluated in the
--- outer context) even though it is rejected inside the fold body.
--- nested reduce() in the list
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [reduce(a = 0, y IN [1, 2, 3] | a + y), 10] | s + x)
-$$) AS (result agtype);
- result 
---------
- 16
-(1 row)
-
--- nested reduce() in the initial value
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = reduce(a = 0, y IN [1, 2, 3] | a + y), x IN [10, 20] | s + x)
-$$) AS (result agtype);
- result 
---------
- 36
-(1 row)
-
---
--- reduce() over a correlated (per-row) list
---
-SELECT * FROM cypher('reduce', $$
-    UNWIND [[1, 2], [3, 4, 5], []] AS arr
-    RETURN reduce(s = 0, x IN arr | s + x) AS total
-    ORDER BY total
-$$) AS (result agtype);
- result 
---------
- 0
- 3
- 12
-(3 rows)
-
---
--- reduce() with the list and initial value bound in an outer clause
---
-SELECT * FROM cypher('reduce', $$
-    WITH [10, 20, 30] AS ns
-    RETURN reduce(t = 0, n IN ns | t + n)
-$$) AS (result agtype);
- result 
---------
- 60
-(1 row)
-
--- the initial value may reference an outer variable (correlation is allowed
--- in the init and the list, only not in the body)
-SELECT * FROM cypher('reduce', $$
-    WITH 5 AS base
-    RETURN reduce(s = base, x IN [1, 2, 3] | s + x)
-$$) AS (result agtype);
- result 
---------
- 11
-(1 row)
-
---
--- reduce() nested inside a list comprehension
---
-SELECT * FROM cypher('reduce', $$
-    RETURN [v IN [1, 2, 3] | reduce(s = 0, x IN [v, v, v] | s + x)]
-$$) AS (result agtype);
-  result   
------------
- [3, 6, 9]
-(1 row)
-
---
--- reduce() in a WHERE clause
---
-SELECT * FROM cypher('reduce', $$
-    UNWIND [[1, 2, 3], [1, 1], [10]] AS l
-    WITH l WHERE reduce(s = 0, x IN l | s + x) > 3
-    RETURN l
-    ORDER BY l
-$$) AS (result agtype);
-  result   
------------
- [1, 2, 3]
- [10]
-(2 rows)
-
---
--- reduce() over graph data (the canonical Cypher example)
---
-SELECT * FROM cypher('reduce', $$
-    CREATE (:person {name: 'Alice', age: 38}),
-           (:person {name: 'Bob', age: 25}),
-           (:person {name: 'Daniel', age: 54})
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- sum the ages of all person nodes
-SELECT * FROM cypher('reduce', $$
-    MATCH (p:person)
-    WITH collect(p) AS people
-    RETURN reduce(total = 0, n IN people | total + n.age)
-$$) AS (result agtype);
- result 
---------
- 117
-(1 row)
-
---
--- reduce() over a graph node's list property
---
-SELECT * FROM cypher('reduce', $$
-    CREATE (:bag {name: 'low', vals: [1, 2, 3]}),
-           (:bag {name: 'mid', vals: [5, 5, 5]}),
-           (:bag {name: 'high', vals: [10, 20, 30]})
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- filter nodes by a reduce() over their list property
-SELECT * FROM cypher('reduce', $$
-    MATCH (u:bag) WHERE reduce(s = 0, x IN u.vals | s + x) > 10
-    RETURN u.name
-    ORDER BY u.name
-$$) AS (result agtype);
- result 
---------
- "high"
- "mid"
-(2 rows)
-
--- compute a reduce() value per node and order by it
-SELECT * FROM cypher('reduce', $$
-    MATCH (u:bag)
-    RETURN u.name AS name, reduce(s = 0, x IN u.vals | s + x) AS total
-    ORDER BY total
-$$) AS (name agtype, total agtype);
-  name  | total 
---------+-------
- "low"  | 6
- "mid"  | 15
- "high" | 60
-(3 rows)
-
---
--- Outer references in the fold body
---
--- The body may reference loop-invariant values from the enclosing query: an
--- outer variable, a property of an outer variable, or a cypher() parameter.
--- a plain outer variable in the body
-SELECT * FROM cypher('reduce', $$
-    WITH 5 AS w
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x + w)
-$$) AS (result agtype);
- result 
---------
- 21
-(1 row)
-
--- an outer variable used as a multiplier
-SELECT * FROM cypher('reduce', $$
-    WITH 3 AS factor
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x * factor)
-$$) AS (result agtype);
- result 
---------
- 18
-(1 row)
-
--- two distinct outer variables in the body
-SELECT * FROM cypher('reduce', $$
-    WITH 2 AS a, 100 AS b
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x * a + b)
-$$) AS (result agtype);
- result 
---------
- 312
-(1 row)
-
--- a property of an outer (graph) variable in the body
-SELECT * FROM cypher('reduce', $$
-    MATCH (u:bag) WHERE u.name = 'mid'
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x + u.vals[0])
-$$) AS (result agtype);
- result 
---------
- 21
-(1 row)
-
--- the same outer variable referenced more than once in the body
-SELECT * FROM cypher('reduce', $$
-    WITH 7 AS k
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + k + k)
-$$) AS (result agtype);
- result 
---------
- 42
-(1 row)
-
--- a property of an outer map referenced in the body
-SELECT * FROM cypher('reduce', $$
-    WITH {factor: 10} AS m
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x * m.factor)
-$$) AS (result agtype);
- result 
---------
- 60
-(1 row)
-
--- a subexpression that mixes an outer reference with the element: only the
--- loop-invariant part (the outer list) is captured, the element index is not
-SELECT * FROM cypher('reduce', $$
-    WITH [10, 20, 30] AS lookup
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + lookup[x - 1])
-$$) AS (result agtype);
- result 
---------
- 60
-(1 row)
-
--- an outer reference inside a CASE branch of the body is captured
-SELECT * FROM cypher('reduce', $$
-    WITH 10 AS w
-    RETURN reduce(s = 0, x IN [1, 2, 3] | CASE WHEN x % 2 = 0 THEN s + w ELSE s + x END)
-$$) AS (result agtype);
- result 
---------
- 14
-(1 row)
-
--- a NULL outer value propagates through the fold
-SELECT * FROM cypher('reduce', $$
-    WITH null AS w
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x + w)
-$$) AS (result agtype);
- result 
---------
- null
-(1 row)
-
--- multiple outer captures with a mix of NULL and non-NULL: each is bound to its
--- own slot (the non-NULL multiplier is bound and the NULL still propagates)
-SELECT * FROM cypher('reduce', $$
-    WITH 3 AS a, null AS b
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + x * a + b)
-$$) AS (result agtype);
- result 
---------
- null
-(1 row)
-
--- an outer variable that changes per row is captured per group
-SELECT * FROM cypher('reduce', $$
-    UNWIND [1, 2, 3] AS m
-    RETURN reduce(s = 0, x IN [1, 2, 3, 4] | s + x * m) AS total
-    ORDER BY total
-$$) AS (result agtype);
- result 
---------
- 10
- 20
- 30
-(3 rows)
-
---
--- Short-circuit evaluation is preserved for outer references in the body
---
--- Only the outer leaf is captured; operators and CASE/AND/OR branches stay in
--- the body, so a guarded outer sub-expression is not evaluated on a branch
--- that is not taken. Each case below would divide by zero if the whole "1/w"
--- were hoisted into an eagerly evaluated aggregate argument instead.
--- the THEN branch is never taken, so "1/w" is not evaluated (expect 6)
-SELECT * FROM cypher('reduce', $$
-    WITH 0 AS w
-    RETURN reduce(s = 0, x IN [1, 2, 3] | CASE WHEN false THEN s + 1/w ELSE s + x END)
-$$) AS (result agtype);
- result 
---------
- 6
-(1 row)
-
--- the ELSE branch is never taken, so "1/w" is not evaluated (expect 6)
-SELECT * FROM cypher('reduce', $$
-    WITH 0 AS w
-    RETURN reduce(s = 0, x IN [1, 2, 3] | CASE WHEN true THEN s + x ELSE s + 1/w END)
-$$) AS (result agtype);
- result 
---------
- 6
-(1 row)
-
--- OR short-circuits once "w = 0" is true, so "1/w > 0" is not evaluated
-SELECT * FROM cypher('reduce', $$
-    WITH 0 AS w
-    RETURN reduce(s = true, x IN [1, 2, 3] | s AND (w = 0 OR 1/w > 0))
-$$) AS (result agtype);
- result 
---------
- true
-(1 row)
-
--- AND short-circuits once "w <> 0" is false, so "1/w > 0" is not evaluated
-SELECT * FROM cypher('reduce', $$
-    WITH 0 AS w
-    RETURN reduce(s = true, x IN [1, 2, 3] | s AND (w <> 0 AND 1/w > 0))
-$$) AS (result agtype);
- result 
---------
- false
-(1 row)
-
--- coalesce short-circuits: "1/w" is not evaluated when arg 1 is non-null
-SELECT * FROM cypher('reduce', $$
-    WITH 0 AS w
-    RETURN reduce(s = 0, x IN [1, 2, 3] | s + coalesce(w, 1/w))
-$$) AS (result agtype);
- result 
---------
- 0
-(1 row)
-
--- when the guarded branch is taken, the outer sub-expression is evaluated
--- normally (division by a non-zero outer value): x = 2 -> s + 10/2 (expect 9)
-SELECT * FROM cypher('reduce', $$
-    WITH 2 AS w
-    RETURN reduce(s = 0, x IN [1, 2, 3] | CASE WHEN x % 2 = 0 THEN s + 10/w ELSE s + x END)
-$$) AS (result agtype);
- result 
---------
- 9
-(1 row)
-
---
--- Not-yet-supported constructs raise a clean feature error
---
--- a nested reduce() in the body (any subquery in the body is unsupported)
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2] | s + reduce(t = 0, y IN [x] | t + y))
-$$) AS (result agtype);
-ERROR:  subqueries (including a nested reduce()) are not supported in a reduce() expression
-LINE 1: SELECT * FROM cypher('reduce', $$
-                                        ^
--- an aggregate function in the body
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2] | s + count(x))
-$$) AS (result agtype);
-ERROR:  aggregate functions are not supported in a reduce() expression
-LINE 1: SELECT * FROM cypher('reduce', $$
-                                        ^
---
--- Syntax errors: each required piece of the reduce() form is enforced
---
--- missing "= init"
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s, x IN [1, 2] | s + x)
-$$) AS (result agtype);
-ERROR:  syntax error at or near ","
-LINE 2:     RETURN reduce(s, x IN [1, 2] | s + x)
-                           ^
--- missing ", var IN list"
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0 | s)
-$$) AS (result agtype);
-ERROR:  syntax error at or near "|"
-LINE 2:     RETURN reduce(s = 0 | s)
-                                ^
--- missing "| body"
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x IN [1, 2])
-$$) AS (result agtype);
-ERROR:  syntax error at or near ")"
-LINE 2:     RETURN reduce(s = 0, x IN [1, 2])
-                                            ^
--- a qualified iterator variable is not allowed
-SELECT * FROM cypher('reduce', $$
-    RETURN reduce(s = 0, x.y IN [1, 2] | s)
-$$) AS (result agtype);
-ERROR:  syntax error at or near "."
-LINE 2:     RETURN reduce(s = 0, x.y IN [1, 2] | s)
-                                  ^
---
--- cypher() parameter referenced in the fold body (via a prepared statement)
---
-PREPARE reduce_param(agtype) AS
-    SELECT * FROM cypher('reduce', $$
-        RETURN reduce(s = 0, x IN [1, 2, 3] | s + x + $p)
-    $$, $1) AS (result agtype);
-EXECUTE reduce_param('{"p": 10}');
- result 
---------
- 36
-(1 row)
-
-EXECUTE reduce_param('{"p": 100}');
- result 
---------
- 306
-(1 row)
-
-DEALLOCATE reduce_param;
---
--- "reduce" as a property key name (safe_keywords backward compatibility):
--- because reduce() introduced a reserved keyword, confirm the word is still
--- usable as a map key, the same way any/none/single are.
---
-SELECT * FROM cypher('reduce', $$
-    RETURN {reduce: 1, any: 2, none: 3}
-$$) AS (result agtype);
-               result               
-------------------------------------
- {"any": 2, "none": 3, "reduce": 1}
-(1 row)
-
---
--- Cleanup
---
-SELECT * FROM drop_graph('reduce', true);
-NOTICE:  drop cascades to 4 other objects
-DETAIL:  drop cascades to table reduce._ag_label_vertex
-drop cascades to table reduce._ag_label_edge
-drop cascades to table reduce.person
-drop cascades to table reduce.bag
-NOTICE:  graph "reduce" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
diff --git a/regress/expected/age_shortest_path.out b/regress/expected/age_shortest_path.out
deleted file mode 100644
index f7f8f130..00000000
--- a/regress/expected/age_shortest_path.out
+++ /dev/null
@@ -1,1729 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-LOAD 'age';
-SET search_path TO ag_catalog;
---
--- age_shortest_path / age_all_shortest_paths
---
-SELECT * FROM create_graph('sp_graph');
-NOTICE:  graph "sp_graph" has been created
- create_graph 
---------------
- 
-(1 row)
-
--- Build a small deterministic graph:
---
---        A
---       / \
---      B   C        (A->B, A->C, B->D, C->D : two shortest A..D paths)
---       \ /
---        D
---        |
---        E          (D->E : unique 3-hop path A..E)
---
---        Z          (isolated, unreachable)
---
-SELECT * FROM cypher('sp_graph', $$
-    CREATE (a:Person {name: 'A'}),
-           (b:Person {name: 'B'}),
-           (c:Person {name: 'C'}),
-           (d:Person {name: 'D'}),
-           (e:Person {name: 'E'}),
-           (z:Person {name: 'Z'}),
-           (a)-[:KNOWS]->(b),
-           (a)-[:KNOWS]->(c),
-           (b)-[:KNOWS]->(d),
-           (c)-[:KNOWS]->(d),
-           (d)-[:KNOWS]->(e)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- materialize the global graph context
-SELECT * FROM cypher('sp_graph', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$)
-    AS (result agtype);
-                                            result                                            
-----------------------------------------------------------------------------------------------
- {"id": 844424930131969, "label": "Person", "in_degree": 0, "out_degree": 2, "self_loops": 0}
- {"id": 844424930131970, "label": "Person", "in_degree": 1, "out_degree": 1, "self_loops": 0}
- {"id": 844424930131971, "label": "Person", "in_degree": 1, "out_degree": 1, "self_loops": 0}
- {"id": 844424930131972, "label": "Person", "in_degree": 2, "out_degree": 1, "self_loops": 0}
- {"id": 844424930131973, "label": "Person", "in_degree": 1, "out_degree": 0, "self_loops": 0}
- {"id": 844424930131974, "label": "Person", "in_degree": 0, "out_degree": 0, "self_loops": 0}
-(6 rows)
-
--- A -> D shortest path (length 2); expected: path_count = 1
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          1
-(1 row)
-
--- all shortest A -> D; expected: 2 paths (A-B-D and A-C-D), each length 2
-SELECT path
-FROM age_all_shortest_paths(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype))
-) AS path
-ORDER BY path;
-                                                                                                                                                                                                                                                       path                                                                                                                                                                                                                                                        
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "Person", "properties": {"name": "A"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": "Person", "properties": {"name": "B"}}::vertex, {"id": 1125899906842627, "label": "KNOWS", "end_id": 844424930131972, "start_id": 844424930131970, "properties": {}}::edge, {"id": 844424930131972, "label": "Person", "properties": {"name": "D"}}::vertex]::path
- [{"id": 844424930131969, "label": "Person", "properties": {"name": "A"}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131971, "label": "Person", "properties": {"name": "C"}}::vertex, {"id": 1125899906842628, "label": "KNOWS", "end_id": 844424930131972, "start_id": 844424930131971, "properties": {}}::edge, {"id": 844424930131972, "label": "Person", "properties": {"name": "D"}}::vertex]::path
-(2 rows)
-
--- A -> E unique 3-hop path; expected: path_count = 1
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'E'}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          1
-(1 row)
-
--- A -> E with max_hops = 2; expected: path_count = 0 (E is 3 hops away)
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'E'}) RETURN id(n) $$) AS (id agtype)),
-    NULL, NULL, NULL, 2::agtype
-);
- path_count 
-------------
-          0
-(1 row)
-
--- zero-length path, start == end; expected: path_count = 1
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          1
-(1 row)
-
--- unreachable vertex Z; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'Z'}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          0
-(1 row)
-
--- direction 'in': D -> A traversing edges backwards; expected: path_count = 2
-SELECT count(*) AS path_count
-FROM age_all_shortest_paths(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    NULL, '"in"'::agtype
-);
- path_count 
-------------
-          2
-(1 row)
-
--- single shortest path with direction 'in': D -> A backwards; expected:
--- path_count = 1 (the single-path variant picks one of the two routes)
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    NULL, '"in"'::agtype
-);
- path_count 
-------------
-          1
-(1 row)
-
--- direction 'out': D -> A not reachable forwards; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    NULL, '"out"'::agtype
-);
- path_count 
-------------
-          0
-(1 row)
-
--- label filter 'KNOWS': A -> D still found; expected: path_count = 1
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype
-);
- path_count 
-------------
-          1
-(1 row)
-
--- error: invalid direction string; expected: ERROR (must be 'out', 'in', or 'any')
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype)),
-    NULL, '"sideways"'::agtype
-);
-ERROR:  age_shortest_path: direction argument must be one of 'out', 'in', or 'any'
--- error: start argument is neither a vertex nor an integer id; expected: ERROR
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    '"not_a_vertex"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'D'}) RETURN id(n) $$) AS (id agtype))
-);
-ERROR:  start vertex argument must be a vertex or the integer id
--- error: end argument is neither a vertex nor an integer id; expected: ERROR
--- (symmetric to the start-vertex check above)
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    '"not_a_vertex"'::agtype
-);
-ERROR:  end vertex argument must be a vertex or the integer id
---
--- Non-existent endpoint guards. These must NOT crash the backend and must
--- return no rows (a path can only exist between vertices in the graph).
--- Previously, start == end on a non-existent vertex id was matched at BFS
--- depth 0 and path reconstruction dereferenced a missing vertex, crashing
--- the server.
---
--- start == end on a non-existent integer id; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path('"sp_graph"'::agtype, 999999::agtype, 999999::agtype);
- path_count 
-------------
-          0
-(1 row)
-
--- existing start -> non-existent end; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    999999::agtype
-);
- path_count 
-------------
-          0
-(1 row)
-
--- non-existent start -> existing end; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_graph"'::agtype,
-    999999::agtype,
-    (SELECT id FROM cypher('sp_graph', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          0
-(1 row)
-
--- all-shortest-paths with start == end non-existent; expected: 0 rows
-SELECT count(*) AS path_count
-FROM age_all_shortest_paths('"sp_graph"'::agtype, 999999::agtype, 999999::agtype);
- path_count 
-------------
-          0
-(1 row)
-
--- cleanup
-SELECT * FROM drop_graph('sp_graph', true);
-NOTICE:  drop cascades to 4 other objects
-DETAIL:  drop cascades to table sp_graph._ag_label_vertex
-drop cascades to table sp_graph._ag_label_edge
-drop cascades to table sp_graph."Person"
-drop cascades to table sp_graph."KNOWS"
-NOTICE:  graph "sp_graph" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
---
--- Empty graph: a graph that exists but has no vertices must return no rows
--- (and must not hang or crash) for any endpoint query.
---
-SELECT * FROM create_graph('sp_empty');
-NOTICE:  graph "sp_empty" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT count(*) AS path_count
-FROM age_shortest_path('"sp_empty"'::agtype, 0::agtype, 1::agtype);
- path_count 
-------------
-          0
-(1 row)
-
-SELECT count(*) AS path_count
-FROM age_all_shortest_paths('"sp_empty"'::agtype, 0::agtype, 0::agtype);
- path_count 
-------------
-          0
-(1 row)
-
-SELECT * FROM drop_graph('sp_empty', true);
-NOTICE:  drop cascades to 2 other objects
-DETAIL:  drop cascades to table sp_empty._ag_label_vertex
-drop cascades to table sp_empty._ag_label_edge
-NOTICE:  graph "sp_empty" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
---
--- A large, programmatically generated graph (120 nodes) exercising long
--- shortest paths (length up to 20), high-multiplicity all-shortest-paths,
--- label filtering, and directed vs. undirected reachability.
---
--- Nodes: (:N {id: 0..119}).  Structures built on top of them:
---
---   * Main chain      0 -> 1 -> ... -> 20            (unique 20-hop path)
---   * Alternate chain 0 -> 50 -> 51 -> ... -> 68 -> 20
---                       (a second, disjoint 20-hop path 0..20)
---       => all-shortest-paths 0..20 under KNOWS = 2 paths of length 20
---   * 3x3 lattice on ids 70..78, id = 70 + 3*row + col, edges go right
---     (id->id+1) and down (id->id+3).  Monotone 70..78 paths:
---       => all-shortest-paths 70..78 = C(4,2) = 6 paths of length 4
---   * LIKES shortcut  0 -[:LIKES]-> 20  (1 hop; only visible when the edge
---     label filter is NOT restricted to KNOWS)
---   * Back-edge triangle 0 -> 96 -> 95 -> 0
---       => directed 0->95 = 2 hops (0-96-95); undirected 0..95 = 1 hop
---   * Many unused ids (e.g. 119) remain isolated / unreachable.
---
-SELECT * FROM create_graph('sp_big');
-NOTICE:  graph "sp_big" has been created
- create_graph 
---------------
- 
-(1 row)
-
--- 120 vertices, ids 0..119
-SELECT * FROM cypher('sp_big', $$
-    UNWIND range(0, 119) AS i CREATE (:N {id: i})
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- main chain 0->1->...->20  (KNOWS)
-SELECT * FROM cypher('sp_big', $$
-    UNWIND range(0, 19) AS i
-    MATCH (a:N {id: i}), (b:N {id: i + 1})
-    CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- alternate, disjoint 20-hop path 0->50->51->...->68->20  (KNOWS)
-SELECT * FROM cypher('sp_big', $$
-    MATCH (a:N {id: 0}), (b:N {id: 50}) CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
-SELECT * FROM cypher('sp_big', $$
-    UNWIND range(50, 67) AS i
-    MATCH (a:N {id: i}), (b:N {id: i + 1})
-    CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
-SELECT * FROM cypher('sp_big', $$
-    MATCH (a:N {id: 68}), (b:N {id: 20}) CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- 3x3 lattice on ids 70..78: right edges (id -> id+1)
-SELECT * FROM cypher('sp_big', $$
-    UNWIND [0, 1, 2] AS r
-    UNWIND [0, 1] AS c
-    MATCH (a:N {id: 70 + 3 * r + c}), (b:N {id: 70 + 3 * r + c + 1})
-    CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- 3x3 lattice: down edges (id -> id+3)
-SELECT * FROM cypher('sp_big', $$
-    UNWIND [0, 1] AS r
-    UNWIND [0, 1, 2] AS c
-    MATCH (a:N {id: 70 + 3 * r + c}), (b:N {id: 70 + 3 * (r + 1) + c})
-    CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- back-edge triangle 0 -> 96 -> 95 -> 0  (KNOWS)
-SELECT * FROM cypher('sp_big', $$
-    MATCH (a:N {id: 0}),  (b:N {id: 96}) CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
-SELECT * FROM cypher('sp_big', $$
-    MATCH (a:N {id: 96}), (b:N {id: 95}) CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
-SELECT * FROM cypher('sp_big', $$
-    MATCH (a:N {id: 95}), (b:N {id: 0})  CREATE (a)-[:KNOWS]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- labelled shortcut 0 -[:LIKES]-> 20
-SELECT * FROM cypher('sp_big', $$
-    MATCH (a:N {id: 0}), (b:N {id: 20}) CREATE (a)-[:LIKES]->(b)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- sanity: vertex count (also materializes the global context); expected: count = 120
-SELECT * FROM cypher('sp_big', $$ MATCH (n) RETURN count(n) $$) AS (n agtype);
-  n  
------
- 120
-(1 row)
-
--- all shortest 0 -> 20 under KNOWS (main chain + disjoint alternate);
--- expected: 2 paths, each exactly 20 hops
-SELECT path
-FROM age_all_shortest_paths(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0})  RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 20}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype
-) AS path
-ORDER BY path;
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             [...]
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [...]
- [{"id": 844424930131969, "label": "N", "properties": {"id": 0}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": "N", "properties": {"id": 1}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge, {"id": 844424930131971, "label": "N", "properties": {"id": 2}}::vertex, {"id": 1125899906842627, " [...]
- [{"id": 844424930131969, "label": "N", "properties": {"id": 0}}::vertex, {"id": 1125899906842645, "label": "KNOWS", "end_id": 844424930132019, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930132019, "label": "N", "properties": {"id": 50}}::vertex, {"id": 1125899906842646, "label": "KNOWS", "end_id": 844424930132020, "start_id": 844424930132019, "properties": {}}::edge, {"id": 844424930132020, "label": "N", "properties": {"id": 51}}::vertex, {"id": 1125899906842647, [...]
-(2 rows)
-
--- any label: the LIKES shortcut collapses 0 -> 20; expected: path_count = 1
-SELECT count(*) AS path_count
-FROM age_all_shortest_paths(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0})  RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 20}) RETURN id(n) $$) AS (id agtype)),
-    NULL, '"out"'::agtype
-);
- path_count 
-------------
-          1
-(1 row)
-
--- all shortest 70 -> 78 across the 3x3 lattice; expected: path_count = 6 (C(4,2))
-SELECT count(*) AS path_count
-FROM age_all_shortest_paths(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 70}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 78}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype
-);
- path_count 
-------------
-          6
-(1 row)
-
--- the lattice paths listed; expected: 6 paths, each 4 hops
-SELECT path
-FROM age_all_shortest_paths(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 70}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 78}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype
-) AS path
-ORDER BY path;
-                                                                                                                                                                                                                                                                                                                                                                                                                                                path                                                         [...]
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [...]
- [{"id": 844424930132039, "label": "N", "properties": {"id": 70}}::vertex, {"id": 1125899906842665, "label": "KNOWS", "end_id": 844424930132040, "start_id": 844424930132039, "properties": {}}::edge, {"id": 844424930132040, "label": "N", "properties": {"id": 71}}::vertex, {"id": 1125899906842666, "label": "KNOWS", "end_id": 844424930132041, "start_id": 844424930132040, "properties": {}}::edge, {"id": 844424930132041, "label": "N", "properties": {"id": 72}}::vertex, {"id": 1125899906842673 [...]
- [{"id": 844424930132039, "label": "N", "properties": {"id": 70}}::vertex, {"id": 1125899906842665, "label": "KNOWS", "end_id": 844424930132040, "start_id": 844424930132039, "properties": {}}::edge, {"id": 844424930132040, "label": "N", "properties": {"id": 71}}::vertex, {"id": 1125899906842672, "label": "KNOWS", "end_id": 844424930132043, "start_id": 844424930132040, "properties": {}}::edge, {"id": 844424930132043, "label": "N", "properties": {"id": 74}}::vertex, {"id": 1125899906842668 [...]
- [{"id": 844424930132039, "label": "N", "properties": {"id": 70}}::vertex, {"id": 1125899906842665, "label": "KNOWS", "end_id": 844424930132040, "start_id": 844424930132039, "properties": {}}::edge, {"id": 844424930132040, "label": "N", "properties": {"id": 71}}::vertex, {"id": 1125899906842672, "label": "KNOWS", "end_id": 844424930132043, "start_id": 844424930132040, "properties": {}}::edge, {"id": 844424930132043, "label": "N", "properties": {"id": 74}}::vertex, {"id": 1125899906842675 [...]
- [{"id": 844424930132039, "label": "N", "properties": {"id": 70}}::vertex, {"id": 1125899906842671, "label": "KNOWS", "end_id": 844424930132042, "start_id": 844424930132039, "properties": {}}::edge, {"id": 844424930132042, "label": "N", "properties": {"id": 73}}::vertex, {"id": 1125899906842667, "label": "KNOWS", "end_id": 844424930132043, "start_id": 844424930132042, "properties": {}}::edge, {"id": 844424930132043, "label": "N", "properties": {"id": 74}}::vertex, {"id": 1125899906842668 [...]
- [{"id": 844424930132039, "label": "N", "properties": {"id": 70}}::vertex, {"id": 1125899906842671, "label": "KNOWS", "end_id": 844424930132042, "start_id": 844424930132039, "properties": {}}::edge, {"id": 844424930132042, "label": "N", "properties": {"id": 73}}::vertex, {"id": 1125899906842667, "label": "KNOWS", "end_id": 844424930132043, "start_id": 844424930132042, "properties": {}}::edge, {"id": 844424930132043, "label": "N", "properties": {"id": 74}}::vertex, {"id": 1125899906842675 [...]
- [{"id": 844424930132039, "label": "N", "properties": {"id": 70}}::vertex, {"id": 1125899906842671, "label": "KNOWS", "end_id": 844424930132042, "start_id": 844424930132039, "properties": {}}::edge, {"id": 844424930132042, "label": "N", "properties": {"id": 73}}::vertex, {"id": 1125899906842674, "label": "KNOWS", "end_id": 844424930132045, "start_id": 844424930132042, "properties": {}}::edge, {"id": 844424930132045, "label": "N", "properties": {"id": 76}}::vertex, {"id": 1125899906842669 [...]
-(6 rows)
-
--- max_hops = 19, one short of the 20-hop route; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0})  RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 20}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, NULL, 19::agtype
-);
- path_count 
-------------
-          0
-(1 row)
-
--- max_hops = 20 admits the full route; expected: path_count = 2
-SELECT count(*) AS path_count
-FROM age_all_shortest_paths(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0})  RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 20}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, NULL, 20::agtype
-);
- path_count 
-------------
-          2
-(1 row)
-
--- DIRECTED out: 0 -> 95 must traverse 0->96->95; expected: 1 path (length 2)
-SELECT path
-FROM age_shortest_path(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0})  RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 95}) RETURN id(n) $$) AS (id agtype)),
-    NULL, '"out"'::agtype
-) AS path
-ORDER BY path;
-                                                                                                                                                                                                                                           path                                                                                                                                                                                                                                           
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "N", "properties": {"id": 0}}::vertex, {"id": 1125899906842677, "label": "KNOWS", "end_id": 844424930132065, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930132065, "label": "N", "properties": {"id": 96}}::vertex, {"id": 1125899906842678, "label": "KNOWS", "end_id": 844424930132064, "start_id": 844424930132065, "properties": {}}::edge, {"id": 844424930132064, "label": "N", "properties": {"id": 95}}::vertex]::path
-(1 row)
-
--- UNDIRECTED: 0 .. 95 via the 95->0 back edge; expected: 1 path (length 1)
-SELECT path
-FROM age_shortest_path(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0})  RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 95}) RETURN id(n) $$) AS (id agtype))
-) AS path
-ORDER BY path;
-                                                                                                                                        path                                                                                                                                         
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "N", "properties": {"id": 0}}::vertex, {"id": 1125899906842679, "label": "KNOWS", "end_id": 844424930131969, "start_id": 844424930132064, "properties": {}}::edge, {"id": 844424930132064, "label": "N", "properties": {"id": 95}}::vertex]::path
-(1 row)
-
--- DIRECTED out: 78 -> 70 against lattice flow; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 78}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 70}) RETURN id(n) $$) AS (id agtype)),
-    NULL, '"out"'::agtype
-);
- path_count 
-------------
-          0
-(1 row)
-
--- UNDIRECTED: 78 .. 70 reverses the lattice; expected: path_count = 6
-SELECT count(*) AS path_count
-FROM age_all_shortest_paths(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 78}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 70}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          6
-(1 row)
-
--- isolated id 119 unreachable from 0; expected: path_count = 0
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0})   RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 119}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          0
-(1 row)
-
--- zero-length path, start == end; expected: path_count = 1
-SELECT count(*) AS path_count
-FROM age_shortest_path(
-    '"sp_big"'::agtype,
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_big', $$ MATCH (n:N {id: 0}) RETURN id(n) $$) AS (id agtype))
-);
- path_count 
-------------
-          1
-(1 row)
-
--- cleanup
-SELECT * FROM drop_graph('sp_big', true);
-NOTICE:  drop cascades to 5 other objects
-DETAIL:  drop cascades to table sp_big._ag_label_vertex
-drop cascades to table sp_big._ag_label_edge
-drop cascades to table sp_big."N"
-drop cascades to table sp_big."KNOWS"
-drop cascades to table sp_big."LIKES"
-NOTICE:  graph "sp_big" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
---
--- Calling the age_* SRFs from inside cypher() (Tier 1).
---
--- Because the functions are prefixed with age_, the cypher() parser resolves
--- the unqualified names 'shortest_path' and 'all_shortest_paths' to
--- ag_catalog.age_shortest_path / ag_catalog.age_all_shortest_paths, and the
--- graph name is auto-injected as the first argument (like vle/vertex_stats),
--- so callers pass only the bound endpoints. A whole vertex implicitly casts to
--- agtype, so the argument types resolve. The SRFs are set-returning and now
--- work in a cypher RETURN projection (ProjectSet), returning one row per path.
---
-SELECT * FROM create_graph('sp_cy');
-NOTICE:  graph "sp_cy" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT * FROM cypher('sp_cy', $$
-    CREATE (a:N {name: 'A'}),
-           (b:N {name: 'B'}),
-           (c:N {name: 'C'}),
-           (a)-[:KNOWS]->(b),
-           (b)-[:KNOWS]->(c)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- materialize the global graph context
-SELECT * FROM cypher('sp_cy', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$)
-    AS (result agtype);
-                                         result                                          
------------------------------------------------------------------------------------------
- {"id": 844424930131969, "label": "N", "in_degree": 0, "out_degree": 1, "self_loops": 0}
- {"id": 844424930131970, "label": "N", "in_degree": 1, "out_degree": 1, "self_loops": 0}
- {"id": 844424930131971, "label": "N", "in_degree": 1, "out_degree": 0, "self_loops": 0}
-(3 rows)
-
--- shortest_path() inside a cypher RETURN; the graph name is auto-injected and
--- the bound vertices are passed; expected: 1 path A..C (length 2)
-SELECT * FROM cypher('sp_cy', $$
-    MATCH (a:N {name:'A'}), (c:N {name:'C'})
-    RETURN shortest_path(a, c)
-$$) AS (path agtype);
-                                                                                                                                                                                                                                                path                                                                                                                                                                                                                                                
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "N", "properties": {"name": "A"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": "N", "properties": {"name": "B"}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge, {"id": 844424930131971, "label": "N", "properties": {"name": "C"}}::vertex]::path
-(1 row)
-
--- all_shortest_paths() inside a cypher RETURN; expected: 1 path A..C (length 2)
-SELECT * FROM cypher('sp_cy', $$
-    MATCH (a:N {name:'A'}), (c:N {name:'C'})
-    RETURN all_shortest_paths(a, c)
-$$) AS (path agtype);
-                                                                                                                                                                                                                                                path                                                                                                                                                                                                                                                
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "N", "properties": {"name": "A"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": "N", "properties": {"name": "B"}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge, {"id": 844424930131971, "label": "N", "properties": {"name": "C"}}::vertex]::path
-(1 row)
-
--- in-cypher with an explicit edge-label filter; expected: 1 path A..C (length 2)
-SELECT * FROM cypher('sp_cy', $$
-    MATCH (a:N {name:'A'}), (c:N {name:'C'})
-    RETURN shortest_path(a, c, 'KNOWS')
-$$) AS (path agtype);
-                                                                                                                                                                                                                                                path                                                                                                                                                                                                                                                
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "N", "properties": {"name": "A"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": "N", "properties": {"name": "B"}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge, {"id": 844424930131971, "label": "N", "properties": {"name": "C"}}::vertex]::path
-(1 row)
-
--- still supported: call the SRF at the top level; expected: 1 path A..C (length 2)
-SELECT path
-FROM age_shortest_path(
-    '"sp_cy"'::agtype,
-    (SELECT id FROM cypher('sp_cy', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_cy', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype))
-) AS path
-ORDER BY path;
-                                                                                                                                                                                                                                                path                                                                                                                                                                                                                                                
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- [{"id": 844424930131969, "label": "N", "properties": {"name": "A"}}::vertex, {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge, {"id": 844424930131970, "label": "N", "properties": {"name": "B"}}::vertex, {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge, {"id": 844424930131971, "label": "N", "properties": {"name": "C"}}::vertex]::path
-(1 row)
-
--- cleanup
-SELECT * FROM drop_graph('sp_cy', true);
-NOTICE:  drop cascades to 4 other objects
-DETAIL:  drop cascades to table sp_cy._ag_label_vertex
-drop cascades to table sp_cy._ag_label_edge
-drop cascades to table sp_cy."N"
-drop cascades to table sp_cy."KNOWS"
-NOTICE:  graph "sp_cy" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
---
--- Edge cases: parallel/multi-edges, self-loops, unknown edge labels,
--- max_hops boundaries (0 and negative), explicit 'any' direction, and
--- NULL / unknown-graph argument errors.
---
-SELECT * FROM create_graph('sp_edge');
-NOTICE:  graph "sp_edge" has been created
- create_graph 
---------------
- 
-(1 row)
-
--- A and B are connected by TWO parallel KNOWS edges plus one LIKES edge.
--- B->C is a single KNOWS edge. S has a self-loop. These exercise the
--- multi-predecessor (parallel edge) logic and the label filter.
-SELECT * FROM cypher('sp_edge', $$
-    CREATE (a:N {name: 'A'}),
-           (b:N {name: 'B'}),
-           (c:N {name: 'C'}),
-           (s:N {name: 'S'}),
-           (a)-[:KNOWS]->(b),
-           (a)-[:KNOWS]->(b),
-           (a)-[:LIKES]->(b),
-           (b)-[:KNOWS]->(c),
-           (s)-[:KNOWS]->(s)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- materialize the global graph context
-SELECT * FROM cypher('sp_edge', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$)
-    AS (result agtype);
-                                         result                                          
------------------------------------------------------------------------------------------
- {"id": 844424930131969, "label": "N", "in_degree": 0, "out_degree": 3, "self_loops": 0}
- {"id": 844424930131970, "label": "N", "in_degree": 3, "out_degree": 1, "self_loops": 0}
- {"id": 844424930131971, "label": "N", "in_degree": 1, "out_degree": 0, "self_loops": 0}
- {"id": 844424930131972, "label": "N", "in_degree": 1, "out_degree": 1, "self_loops": 1}
-(4 rows)
-
--- parallel edges: two distinct KNOWS edges A->B are two distinct shortest
--- paths; expected count 2
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'B'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype);
- count 
--------
-     2
-(1 row)
-
--- no label filter: 2 KNOWS + 1 LIKES edge A->B are three distinct shortest
--- paths; expected count 3
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'B'}) RETURN id(n) $$) AS (id agtype)),
-    NULL::agtype, '"out"'::agtype);
- count 
--------
-     3
-(1 row)
-
--- single shortest path A->B picks exactly one of the parallel edges; count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'B'}) RETURN id(n) $$) AS (id agtype)));
- count 
--------
-     1
-(1 row)
-
--- self-loop: a vertex with an edge to itself yields only the zero-length
--- path for start == end (the self-loop is never used); count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'S'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'S'}) RETURN id(n) $$) AS (id agtype)));
- count 
--------
-     1
-(1 row)
-
--- all_shortest_paths with start == end (existing vertex): one zero-length
--- path; count 1
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'S'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'S'}) RETURN id(n) $$) AS (id agtype)));
- count 
--------
-     1
-(1 row)
-
--- unknown relationship type matches no edges: A..C filtered by a label that
--- does not exist must return no path (NOT silently fall back to all edges);
--- count 0
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"NOSUCHLABEL"'::agtype, '"out"'::agtype);
- count 
--------
-     0
-(1 row)
-
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"NOSUCHLABEL"'::agtype, '"out"'::agtype);
- count 
--------
-     0
-(1 row)
-
--- the zero-length (start == end) path has no edges, so an unknown label
--- still matches it; count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'S'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'S'}) RETURN id(n) $$) AS (id agtype)),
-    '"NOSUCHLABEL"'::agtype, '"out"'::agtype);
- count 
--------
-     1
-(1 row)
-
--- existing label that does not connect the endpoints: LIKES only exists on
--- A->B, so A..C filtered by LIKES is unreachable; count 0
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"LIKES"'::agtype, '"out"'::agtype);
- count 
--------
-     0
-(1 row)
-
--- max_hops = 0 with start == end: the zero-length path is still returned;
--- count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    NULL::agtype, NULL::agtype, NULL::agtype, '0'::agtype);
- count 
--------
-     1
-(1 row)
-
--- max_hops = 0 with adjacent distinct endpoints: no path within zero hops;
--- count 0
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'B'}) RETURN id(n) $$) AS (id agtype)),
-    NULL::agtype, NULL::agtype, NULL::agtype, '0'::agtype);
- count 
--------
-     0
-(1 row)
-
--- negative max_hops is treated as unbounded: A..C (length 2) is found;
--- count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    NULL::agtype, NULL::agtype, NULL::agtype, '-1'::agtype);
- count 
--------
-     1
-(1 row)
-
--- explicit 'any' direction string (vs the default NULL == undirected);
--- two parallel KNOWS edges A->B give two shortest paths; count 2
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'B'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"any"'::agtype);
- count 
--------
-     2
-(1 row)
-
--- NULL start (or end) vertex yields no rows (Cypher null semantics: a null
--- endpoint simply produces no match, it is not an error); count 0
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    NULL::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'B'}) RETURN id(n) $$) AS (id agtype)));
- count 
--------
-     0
-(1 row)
-
--- NULL end vertex likewise yields no rows; count 0
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    NULL::agtype);
- count 
--------
-     0
-(1 row)
-
--- all_shortest_paths with a NULL endpoint also yields no rows; count 0
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    NULL::agtype);
- count 
--------
-     0
-(1 row)
-
--- a single relationship type may be passed as a one-element array; expected:
--- same as the bare-string form, A..C under KNOWS (length 2); count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '["KNOWS"]'::agtype, '"out"'::agtype);
- count 
--------
-     1
-(1 row)
-
--- multiple relationship types: an array of types matches an edge whose type
--- is any one of them. A..C single shortest under {KNOWS, LIKES} (length 2);
--- count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '["KNOWS", "LIKES"]'::agtype, '"out"'::agtype);
- count 
--------
-     1
-(1 row)
-
--- all shortest A..C under {KNOWS, LIKES}: three A->B edges (2 KNOWS + 1 LIKES)
--- each extend by the single B->C KNOWS edge; count 3
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '["KNOWS", "LIKES"]'::agtype, '"out"'::agtype);
- count 
--------
-     3
-(1 row)
-
--- all shortest A..B under {KNOWS, LIKES}: the two parallel KNOWS edges plus
--- the one LIKES edge are three distinct one-hop paths; count 3
-SELECT count(*) FROM age_all_shortest_paths(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'B'}) RETURN id(n) $$) AS (id agtype)),
-    '["KNOWS", "LIKES"]'::agtype, '"any"'::agtype);
- count 
--------
-     3
-(1 row)
-
--- a multi-type array containing an unknown type ignores the unknown member:
--- {NOSUCHLABEL, KNOWS} still finds A..C via KNOWS; count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '["NOSUCHLABEL", "KNOWS"]'::agtype, '"out"'::agtype);
- count 
--------
-     1
-(1 row)
-
--- a multi-type array of only types that do not connect the endpoints:
--- {LIKES} reaches B but B..C has no LIKES edge, so A..C is unreachable;
--- count 0
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '["LIKES", "NOSUCHLABEL"]'::agtype, '"out"'::agtype);
- count 
--------
-     0
-(1 row)
-
--- an empty relationship-type array imposes no filter (same as NULL): A..C
--- (length 2) is found; count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '[]'::agtype, '"out"'::agtype);
- count 
--------
-     1
-(1 row)
-
--- a non-string element in the relationship-type array is an error
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '["KNOWS", 7]'::agtype, '"out"'::agtype);
-ERROR:  age_shortest_path: relationship type must be a string
--- a minimum hop count that does not exceed the shortest distance imposes no
--- extra constraint; A..C via KNOWS has length 2, so min_hops=2 is accepted and
--- returns the length-2 path; count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, 2::agtype);
- count 
--------
-     1
-(1 row)
-
--- a minimum hop count greater than the shortest distance falls back to the
--- exhaustive (VLE) search; A..C in this DAG has no length-3 path (every longer
--- route would have to reuse an edge), so min_hops=3 yields no rows; count 0
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, 3::agtype);
- count 
--------
-     0
-(1 row)
-
--- a minimum hop count of 0 is the default and is accepted; A..C (length 2);
--- count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, 0::agtype);
- count 
--------
-     1
-(1 row)
-
--- a graph name that does not exist is an error
-SELECT count(*) FROM age_shortest_path('"no_such_graph"'::agtype, '1'::agtype, '2'::agtype);
-ERROR:  schema "no_such_graph" does not exist
--- a NULL graph name is an error (the graph name is required, unlike the
--- endpoints which accept NULL as "no match")
-SELECT count(*) FROM age_shortest_path(
-    NULL::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)));
-ERROR:  age_shortest_path: graph name cannot be NULL
--- a non-integer max_hops is an error (the hop bounds must be integers)
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, NULL::agtype, '"not_an_int"'::agtype);
-ERROR:  age_shortest_path: agtype argument of wrong type
--- a non-integer min_hops is an error (symmetric to max_hops above)
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, '"not_an_int"'::agtype);
-ERROR:  age_shortest_path: agtype argument of wrong type
--- a negative min_hops is clamped to 0 (no constraint), so A..C (length 2) is
--- still found; count 1
-SELECT count(*) FROM age_shortest_path(
-    '"sp_edge"'::agtype,
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'A'}) RETURN id(n) $$) AS (id agtype)),
-    (SELECT id FROM cypher('sp_edge', $$ MATCH (n {name:'C'}) RETURN id(n) $$) AS (id agtype)),
-    '"KNOWS"'::agtype, '"out"'::agtype, '-3'::agtype);
- count 
--------
-     1
-(1 row)
-
--- cleanup
-SELECT * FROM drop_graph('sp_edge', true);
-NOTICE:  drop cascades to 5 other objects
-DETAIL:  drop cascades to table sp_edge._ag_label_vertex
-drop cascades to table sp_edge._ag_label_edge
-drop cascades to table sp_edge."N"
-drop cascades to table sp_edge."KNOWS"
-drop cascades to table sp_edge."LIKES"
-NOTICE:  graph "sp_edge" has been dropped
- drop_graph 
-------------
- 
-(1 row)
-
---
--- Calling shortest_path / all_shortest_paths from inside cypher() (Tier 1)
--- WITH a relationship-type filter -- both a single type (bare string) and
--- multiple types (a list literal). The graph name is auto-injected, so the
--- in-cypher call passes only the bound endpoints and the type filter.
---
--- Graph: A and B are joined by two parallel KNOWS edges plus one LIKES edge;
--- B->C is a single KNOWS edge. This lets the all_shortest_paths variant return
--- more than one path so the multiplicity is visible.
---
-SELECT * FROM create_graph('sp_cy_lbl');
-NOTICE:  graph "sp_cy_lbl" has been created
- create_graph 
---------------
- 
-(1 row)
-
-SELECT * FROM cypher('sp_cy_lbl', $$
-    CREATE (a:N {name: 'A'}),
-           (b:N {name: 'B'}),
-           (c:N {name: 'C'}),
-           (a)-[:KNOWS]->(b),
-           (a)-[:KNOWS]->(b),
-           (a)-[:LIKES]->(b),
-           (b)-[:KNOWS]->(c)
-$$) AS (result agtype);
- result 
---------
-(0 rows)
-
--- materialize the global graph context
-SELECT * FROM cypher('sp_cy_lbl', $$ MATCH (u) RETURN vertex_stats(u) ORDER BY id(u) $$)
-    AS (result agtype);
-                                         result                                          
------------------------------------------------------------------------------------------
- {"id": 844424930131969, "label": "N", "in_degree": 0, "out_degree": 3, "self_loops": 0}
- {"id": 844424930131970, "label": "N", "in_degree": 3, "out_degree": 1, "self_loops": 0}
- {"id": 844424930131971, "label": "N", "in_degree": 1, "out_degree": 0, "self_loops": 0}
-(3 rows)
-
--- shortest_path() in-cypher with a single relationship type; A..C via KNOWS
--- (length 2); expected: 1 path
-SELECT count(*) FROM cypher('sp_cy_lbl', $$
-    MATCH (a:N {name:'A'}), (c:N {name:'C'})
-    RETURN shortest_path(a, c, 'KNOWS')
-$$) AS (path agtype);
- count 
--------
-     1
-(1 row)
-
--- all_shortest_paths() in-cypher with a single relationship type; the two
--- parallel KNOWS edges A->B make two distinct shortest A..C paths; expected: 2
-SELECT count(*) FROM cypher('sp_cy_lbl', $$
-    MATCH (a:N {name:'A'}), (c:N {name:'C'})
-    RETURN all_shortest_paths(a, c, 'KNOWS')
-$$) AS (path agtype);
- count 
--------
-     2
-(1 row)
-
--- shortest_path() in-cypher with multiple relationship types passed as a list
--- literal; A..C under {KNOWS, LIKES} (length 2); expected: 1 path
-SELECT count(*) FROM cypher('sp_cy_lbl', $$
-    MATCH (a:N {name:'A'}), (c:N {name:'C'})
-    RETURN shortest_path(a, c, ['KNOWS', 'LIKES'])
-$$) AS (path agtype);
- count 
--------
-     1
-(1 row)
-
--- all_shortest_paths() in-cypher with multiple relationship types; the three
--- A->B edges (2 KNOWS + 1 LIKES) each extend by the single B->C KNOWS edge,
--- giving three distinct shortest A..C paths; expected: 3
-SELECT count(*) FROM cypher('sp_cy_lbl', $$
-    MATCH (a:N {name:'A'}), (c:N {name:'C'})
-    RETURN all_shortest_paths(a, c, ['KNOWS', 'LIKES'])
-$$) AS (path agtype);
- count 
--------
-     3
-(1 row)
-
--- all_shortest_paths() in-cypher, multiple types, adjacent endpoints: the two
--- parallel KNOWS edges plus the one LIKES edge are three one-hop A..B paths;
--- expected: 3
-SELECT count(*) FROM cypher('sp_cy_lbl', $$
-    MATCH (a:N {name:'A'}), (b:N {name:'B'})
... 43895 lines suppressed ...