crprashant commented on issue #2195:
URL: https://github.com/apache/age/issues/2195#issuecomment-4315498956

   ## Status check on PG18 + AGE 1.7.0
   
   I looked into whether this is resolved on the newer stack (PostgreSQL 18 + 
Apache AGE 1.7.0, released as `PG18/v1.7.0-rc0` on 2026-01-21, which is the 
first AGE release supporting PG18 via #2251).
   
   **Short answer: not resolved, and arguably not a bug — but the docs could 
help.**
   
   ### What I checked
   - Release notes for 
[`PG18/v1.7.0-rc0`](https://github.com/apache/age/releases/tag/PG18/v1.7.0-rc0) 
and 
[`PG17/v1.7.0-rc0`](https://github.com/apache/age/releases/tag/PG17/v1.7.0-rc0) 
— no entry references `LOAD`, `search_path`, transaction visibility, or 
cross-session persistence of AGE setup.
   - No PRs linked to this issue, no assignee, no milestone.
   
   ### Why the behavior persists (and is expected)
   The described symptom is actually standard PostgreSQL transaction semantics, 
not something AGE can "fix" without violating them:
   
   1. `LOAD 'age'` and `SET search_path = ...` are **session-local** — they 
don't write to the catalog and have nothing to commit.
   2. `SELECT * FROM create_graph('my_graph')` **does** write to `ag_graph` and 
creates a schema — those writes are catalog changes that must be in a 
**committed top-level transaction** to be visible to other sessions.
   3. In `psycopg` with the default (non-autocommit) mode, the very first 
statement (`LOAD 'age'`) implicitly starts an outer transaction. The later 
`with connection.transaction():` block then runs as a **savepoint inside that 
outer transaction**, not as its own top-level transaction. Releasing a 
savepoint is not a commit — the outer transaction stays open until 
`connection.commit()` or `connection.close()`.
   
   That's why the explicit `connection.commit()` after `LOAD`/`SET` "fixes" it: 
it closes the implicit outer transaction, so the subsequent `with 
connection.transaction()` block becomes a real top-level transaction that 
actually commits the `create_graph` writes.
   
   PostgreSQL 18 does not change this model, and AGE 1.7.0 contains no change 
that would alter it.
   
   ### Suggested resolutions
   Making AGE bypass transactional visibility for `create_graph` would break 
ACID guarantees, so the "Preferred" option in the original post probably isn't 
viable. The practical paths forward:
   
   - **Docs (acceptable fallback in the original issue):** add a "Using AGE 
with non-autocommit clients (psycopg, JDBC, etc.)" section to the README / 
setup guide explicitly stating:
     - `create_graph`, `create_vlabel`, `create_elabel`, `drop_graph`, etc. 
perform catalog writes.
     - In non-autocommit clients, call `connection.commit()` (or set 
`autocommit=True` for setup) so those writes become visible to other sessions.
     - Explain the psycopg "implicit outer transaction + savepoint" gotcha, 
which is the real source of confusion here.
   
   Happy to open a docs PR if maintainers agree this is the right direction.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to