Skip to content

[Segmentation Fault] when creating graph node whose vertex label table has GENERATED ALWAYS columns #2450

Description

@bilalsp

Describe the bug
Adding a GENERATED ALWAYS AS (...) STORED column to a vertex label table (_ag_label_vertex child table) causes a segmentation fault (signal 11) during Cypher CREATE / SET operations.
The crash occurs in the vertex creation path (likely during heap_insert in the executor).

How are you accessing AGE (Command line, driver, etc.)?
Directly via cypher() SQL function (IN psql client).

What data setup do we need to do?

-- 1. Create graph and label
SELECT create_graph('age_bug');
SELECT create_vlabel('age_bug', 'Product');

-- 2. Add generated column (this triggers the bug)
ALTER TABLE age_bug."Product"
	ADD COLUMN category VARCHAR(25) GENERATED ALWAYS AS (agtype_access_operator(properties, '"category"')) STORED;

What is the necessary configuration info needed?

  • [e.g. Installed PostGIS]

What is the command that caused the error?

SELECT * FROM cypher('age_bug', $$
   CREATE (p:Product {category: 'disk', type: 'M1234', version: 1})
   RETURN p
$$) AS (p agtype);
ERROR: 
psql client log: 
SQL Error [08006]: An I/O error occurred while sending to the backend.

server log: 
LOG:  server process (PID XXX) was terminated by signal 11: Segmentation fault
DETAIL:  Failed process was running: [the cypher CREATE query]
LOG:  terminating any other active server processes
FATAL:  the database system is in recovery mode
FATAL:  the database system is in recovery mode
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at  XXXX
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  invalid record length at 5716/4C635DA8: wanted 24, got 0
LOG:  redo is not required
LOG:  checkpoint starting: end-of-recovery immediate wait
LOG:  checkpoint complete: wrote 2 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.006 s, sync=0.003 s, total=0.017 s; sync files=3, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB
LOG:  database system is ready to accept connections
FATAL:  database "template0" is not currently accepting connections
LOG:  background worker "autoprewarm worker" (PID XXX) exited with exit code 1

Even though MATCH query does NOT RAISE ANY error

SELECT * FROM cypher('age_bug', $$
   MATCH (p:Product {category: 'disk', type: 'M1234', version: 1})
   RETURN p
$$) AS (p agtype);

Expected behavior
AGE should support standard PostgreSQL features like generated columns on label TABLES

Environment (please complete the following information):

  • AGE Version: release/PG15/1.5.0
  • PostgreSQL Version: PostgreSQL 15.8 (Debian 15.8-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
  • OS: Linux

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions