diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 967eea44..2f12ed36 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -1003,6 +1003,12 @@ transformRangeGraphTable(ParseState *pstate, RangeGraphTable *rgt) columns = lappend(columns, te); } + /* + * Assign collations to column expressions, just as we do for the WHERE + * clause in transformGraphPattern(). + */ + assign_expr_collations(pstate, (Node *) columns); + table_close(rel, NoLock); pstate->p_graph_table_pstate = NULL; diff --git a/src/test/regress/expected/graph_table.out b/src/test/regress/expected/graph_table.out index b579e3df..0a84c7eb 100644 --- a/src/test/regress/expected/graph_table.out +++ b/src/test/regress/expected/graph_table.out @@ -679,6 +679,23 @@ SELECT * FROM GRAPH_TABLE (g1 MATCH (a)-[b]->(a)-[b]->(a) COLUMNS (a.vname AS se v33 | e331 (1 row) +-- test collation assignment for COLUMNS expressions +SELECT * FROM GRAPH_TABLE (g1 MATCH (src)->(dest) COLUMNS (upper(src.vname) AS u)) ORDER BY u; + u +----- + V11 + V11 + V11 + V12 + V13 + V21 + V22 + V23 + V32 + V33 + V33 +(11 rows) + -- property graph with some of the elements, labels and properties same as the -- previous one. Test whether components from the specified property graph are -- used. Also test explicit collation specification in property. diff --git a/src/test/regress/sql/graph_table.sql b/src/test/regress/sql/graph_table.sql index 4ff98817..ffb7cbe6 100644 --- a/src/test/regress/sql/graph_table.sql +++ b/src/test/regress/sql/graph_table.sql @@ -400,6 +400,8 @@ SELECT * FROM GRAPH_TABLE (g1 MATCH (a)-[b]->(a)-[b]->(a) COLUMNS (a.vname AS se SELECT * FROM GRAPH_TABLE (g1 MATCH (a)-[b IS el2 WHERE b.ename > 'E331' COLLATE "C"]->(a)-[b]->(a) COLUMNS (a.vname AS self, b.ename AS loop_name)); SELECT * FROM GRAPH_TABLE (g1 MATCH (a)-[b]->(a)-[b]->(a) WHERE b.ename > 'E331' COLLATE "C" COLUMNS (a.vname AS self, b.ename AS loop_name)); SELECT * FROM GRAPH_TABLE (g1 MATCH (a)-[b]->(a)-[b]->(a) COLUMNS (a.vname AS self, b.ename AS loop_name)) WHERE loop_name > 'E331' COLLATE "C"; +-- test collation assignment for COLUMNS expressions +SELECT * FROM GRAPH_TABLE (g1 MATCH (src)->(dest) COLUMNS (upper(src.vname) AS u)) ORDER BY u; -- property graph with some of the elements, labels and properties same as the -- previous one. Test whether components from the specified property graph are