diff --git a/duckdb b/duckdb index 0c82f0e..c380346 160000 --- a/duckdb +++ b/duckdb @@ -1 +1 @@ -Subproject commit 0c82f0ed582ed2737216539845028826badb4bda +Subproject commit c380346433db588352999594227f2f8d23be2f49 diff --git a/test/sql/create_pg/create_if_not_exists.test b/test/sql/create_pg/create_if_not_exists.test new file mode 100644 index 0000000..199dae7 --- /dev/null +++ b/test/sql/create_pg/create_if_not_exists.test @@ -0,0 +1,68 @@ + + +require duckpgq + +statement ok +CREATE TABLE Student(id BIGINT, name VARCHAR); + +statement ok +CREATE TABLE know(src BIGINT, dst BIGINT, createDate BIGINT); + +statement ok +CREATE TABLE School(school_name VARCHAR, school_id BIGINT, school_kind BIGINT); + +statement ok +INSERT INTO Student VALUES (0, 'Daniel'), (1, 'Tavneet'), (2, 'Gabor'), (3, 'Peter'); + +statement ok +INSERT INTO know VALUES (0,1, 10), (0,2, 11), (0,3, 12), (1,2, 14), (1,3, 15), (2,3, 16); + +statement ok +-CREATE PROPERTY GRAPH IF NOT EXISTS pg_all_properties +VERTEX TABLES ( + Student, + School LABEL School IN School_kind (Hogeschool, University) + ) +EDGE TABLES ( + know SOURCE KEY ( src ) REFERENCES Student ( id ) + DESTINATION KEY ( dst ) REFERENCES Student ( id ) + LABEL Knows + ) + +query I +select count(*) from __duckpgq_internal where is_vertex_table; +---- +2 + +statement ok +-CREATE PROPERTY GRAPH IF NOT EXISTS pg_all_properties +VERTEX TABLES ( + Student + ) +EDGE TABLES ( + know SOURCE KEY ( src ) REFERENCES Student ( id ) + DESTINATION KEY ( dst ) REFERENCES Student ( id ) + LABEL Knows + ) + +query I +select count(*) from __duckpgq_internal where is_vertex_table; +---- +2 + +statement ok +-CREATE PROPERTY GRAPH IF NOT EXISTS snb +VERTEX TABLES ( + Student + ) +EDGE TABLES ( + know SOURCE KEY ( src ) REFERENCES Student ( id ) + DESTINATION KEY ( dst ) REFERENCES Student ( id ) + LABEL Knows + ) + +query I +select distinct property_graph from __duckpgq_internal order by property_graph desc; +---- +snb +pg_all_properties