DROP PROPERTY GRAPH IF EXISTS pgq_g3;
CREATE TABLE pgq_u1 (id int PRIMARY KEY, nm text);
CREATE TABLE pgq_u2 (id int PRIMARY KEY, nm text);
INSERT INTO pgq_u1 VALUES (1,'v11'),(2,'v12'),(3,'v13');
INSERT INTO pgq_u2 VALUES (4,'v21'),(5,'v22'),(6,'v23');
CREATE PROPERTY GRAPH pgq_g3 VERTEX TABLES (
    pgq_u1 LABEL k1 PROPERTIES (nm),
    pgq_u2 LABEL k2 PROPERTIES (nm));
CREATE TABLE pgq_tgt3 (b text);

-- spurious error
INSERT INTO pgq_tgt3 SELECT c
  FROM GRAPH_TABLE (pgq_g3 MATCH (v IS k1|k2) COLUMNS (v.nm, 'lit' AS c))
;
SELECT length(b), left(b::bytea::text, 60) FROM pgq_tgt3;

-- out-of-bounds / crash
INSERT INTO pgq_tgt3 SELECT c
  FROM GRAPH_TABLE (pgq_g3 MATCH (v IS k1|k2) COLUMNS (v.nm, 'lit' AS c))
  ORDER BY nm;
SELECT length(b), left(b::bytea::text, 60) FROM pgq_tgt3;
