diff --git a/src/backend/commands/propgraphcmds.c b/src/backend/commands/propgraphcmds.c index 076005226f2..2bdce331c49 100644 --- a/src/backend/commands/propgraphcmds.c +++ b/src/backend/commands/propgraphcmds.c @@ -342,7 +342,8 @@ propgraph_element_get_key(ParseState *pstate, const List *key_clause, Relation e Relation indexDesc; indexDesc = index_open(pkidx, AccessShareLock); - a = array_from_attnums(indexDesc->rd_index->indkey.dim1, indexDesc->rd_index->indkey.values); + a = array_from_attnums(IndexRelationGetNumberOfKeyAttributes(indexDesc), + indexDesc->rd_index->indkey.values); index_close(indexDesc, NoLock); } } diff --git a/src/test/regress/expected/create_property_graph.out b/src/test/regress/expected/create_property_graph.out index 646e5fed5e2..5bbd6477ed6 100644 --- a/src/test/regress/expected/create_property_graph.out +++ b/src/test/regress/expected/create_property_graph.out @@ -12,7 +12,8 @@ ERROR: relation "g1" already exists CREATE TABLE t1 (a int, b text); CREATE TABLE t2 (i int PRIMARY KEY, j int, k int); CREATE TABLE t3 (x int, y text, z text); -CREATE TABLE e1 (a int, i int, t text, PRIMARY KEY (a, i)); +-- INCLUDE column must not become part of the inferred element key +CREATE TABLE e1 (a int, i int, t text, PRIMARY KEY (a, i) INCLUDE (t)); CREATE TABLE e2 (a int, x int, t text); CREATE PROPERTY GRAPH g2 VERTEX TABLES (t1 KEY (a), t2 DEFAULT LABEL, t3 KEY (x) LABEL t3l1 LABEL t3l2) diff --git a/src/test/regress/sql/create_property_graph.sql b/src/test/regress/sql/create_property_graph.sql index b1a8d12a040..2b8269d66ec 100644 --- a/src/test/regress/sql/create_property_graph.sql +++ b/src/test/regress/sql/create_property_graph.sql @@ -17,7 +17,8 @@ CREATE TABLE t1 (a int, b text); CREATE TABLE t2 (i int PRIMARY KEY, j int, k int); CREATE TABLE t3 (x int, y text, z text); -CREATE TABLE e1 (a int, i int, t text, PRIMARY KEY (a, i)); +-- INCLUDE column must not become part of the inferred element key +CREATE TABLE e1 (a int, i int, t text, PRIMARY KEY (a, i) INCLUDE (t)); CREATE TABLE e2 (a int, x int, t text); CREATE PROPERTY GRAPH g2