Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions regress/expected/catalog.out
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,55 @@ NOTICE: graph "graph" has been dropped

(1 row)

--
-- create_label() must not resolve graphid_ops through the search_path
--
-- Every AGE object is referenced with an ag_catalog qualified name here, so
-- these statements have to work with ag_catalog off the search_path.
--
SET search_path TO public;
SELECT ag_catalog.create_graph('graphid_ops_search_path');
NOTICE: graph "graphid_ops_search_path" has been created
create_graph
--------------

(1 row)

-- vertex labels index id, edge labels index start_id and end_id
SELECT ag_catalog.create_vlabel('graphid_ops_search_path', 'v');
NOTICE: VLabel "v" has been created
create_vlabel
---------------

(1 row)

SELECT ag_catalog.create_elabel('graphid_ops_search_path', 'e');
NOTICE: ELabel "e" has been created
create_elabel
---------------

(1 row)

-- label creation at query time goes through the same path
SELECT * FROM ag_catalog.cypher('graphid_ops_search_path',
$$CREATE (:query_time_v)-[:query_time_e]->(:query_time_v)$$)
AS (result ag_catalog.agtype);
result
--------
(0 rows)

SELECT ag_catalog.drop_graph('graphid_ops_search_path', true);
NOTICE: drop cascades to 6 other objects
DETAIL: drop cascades to table graphid_ops_search_path._ag_label_vertex
drop cascades to table graphid_ops_search_path._ag_label_edge
drop cascades to table graphid_ops_search_path.v
drop cascades to table graphid_ops_search_path.e
drop cascades to table graphid_ops_search_path.query_time_v
drop cascades to table graphid_ops_search_path.query_time_e
NOTICE: graph "graphid_ops_search_path" has been dropped
drop_graph
------------

(1 row)

SET search_path TO ag_catalog;
18 changes: 18 additions & 0 deletions regress/sql/catalog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,21 @@ SELECT count(*) FROM ag_label;
-- dropping the graphs
SELECT drop_graph('issue_2245', true);
SELECT drop_graph('graph', true);

--
-- create_label() must not resolve graphid_ops through the search_path
--
-- Every AGE object is referenced with an ag_catalog qualified name here, so
-- these statements have to work with ag_catalog off the search_path.
--
SET search_path TO public;
SELECT ag_catalog.create_graph('graphid_ops_search_path');
-- vertex labels index id, edge labels index start_id and end_id
SELECT ag_catalog.create_vlabel('graphid_ops_search_path', 'v');
SELECT ag_catalog.create_elabel('graphid_ops_search_path', 'e');
-- label creation at query time goes through the same path
SELECT * FROM ag_catalog.cypher('graphid_ops_search_path',
$$CREATE (:query_time_v)-[:query_time_e]->(:query_time_v)$$)
AS (result ag_catalog.agtype);
SELECT ag_catalog.drop_graph('graphid_ops_search_path', true);
SET search_path TO ag_catalog;
3 changes: 2 additions & 1 deletion src/backend/commands/label_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ static void create_index_on_column(char *schema_name,
index_col->expr = NULL;
index_col->indexcolname = NULL;
index_col->collation = NIL;
index_col->opclass = list_make1(makeString("graphid_ops"));
index_col->opclass = list_make2(makeString("ag_catalog"),
makeString("graphid_ops"));
index_col->opclassopts = NIL;
index_col->ordering = SORTBY_DEFAULT;
index_col->nulls_ordering = SORTBY_NULLS_DEFAULT;
Expand Down