Bug: Missing collation assignment for GRAPH_TABLE COLUMNS expressions - Mailing list pgsql-hackers

From SATYANARAYANA NARLAPURAM
Subject Bug: Missing collation assignment for GRAPH_TABLE COLUMNS expressions
Date
Msg-id CAHg+QDc4aaiufYSgrwMMPMMRTPtQ66SghcrPFbWJFZMqNaG+BA@mail.gmail.com
Whole thread Raw
Responses Re: Bug: Missing collation assignment for GRAPH_TABLE COLUMNS expressions
List pgsql-hackers
Hi hackers,

GRAPH_TABLE COLUMNS expressions that involve collation-dependent functions or operators fail with:

  ERROR: could not determine which collation to use for upper() function
  HINT: Use the COLLATE clause to set the collation explicitly.

Setup: 

  CREATE TABLE vtx (id int PRIMARY KEY, name text);
  CREATE TABLE edg (id int PRIMARY KEY,
                    src int REFERENCES vtx(id),
                    dst int REFERENCES vtx(id));
  INSERT INTO vtx VALUES (1,'Alice'),(2,'Bob'),(3,'Carol');
  INSERT INTO edg VALUES (1,1,2),(2,2,3);

  CREATE PROPERTY GRAPH g
    VERTEX TABLES (vtx KEY (id))
    EDGE TABLES (edg KEY (id)
      SOURCE KEY (src) REFERENCES vtx (id)
      DESTINATION KEY (dst) REFERENCES vtx (id));

postgres=# SELECT * FROM GRAPH_TABLE (g
  MATCH (a IS vtx)-[e IS edg]->(b IS vtx) COLUMNS (upper(a.name) AS src_upper));
ERROR:  could not determine which collation to use for upper() function
HINT:  Use the COLLATE clause to set the collation explicitly.


In transformRangeGraphTable(), the COLUMNS transformation loop calls transformExpr() 
on each column expression but omits the subsequent assign_expr_collations() call.  Both 
WHERE clause transformation sites in parse_graphtable.c correctly include it.

Attached a patch to fix this.

Thanks,
Satya
Attachment

pgsql-hackers by date:

Previous
From: Daniil Davydov
Date:
Subject: Re: Fix bug with accessing to temporary tables of other sessions
Next
From: Robert Haas
Date:
Subject: Re: pg_stash_advice doc