From 86f4d324f573658e04b121aa24d1484efdfecb8a Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Wed, 27 Mar 2024 18:02:42 +0100 Subject: [PATCH 01/11] Add test --- test/sql/create_pg/describe_pg.test | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/sql/create_pg/describe_pg.test diff --git a/test/sql/create_pg/describe_pg.test b/test/sql/create_pg/describe_pg.test new file mode 100644 index 00000000..f0be3d0f --- /dev/null +++ b/test/sql/create_pg/describe_pg.test @@ -0,0 +1,23 @@ +# name: test/sql/sqlpgq/snb.test +# group: [duckpgq] + +require duckpgq + +statement ok +import database 'duckdb-pgq/data/SNB0.003'; + +statement ok +-CREATE PROPERTY GRAPH snb +VERTEX TABLES ( + Person LABEL Person + ) +EDGE TABLES ( + Person_knows_person SOURCE KEY (Person1Id) REFERENCES Person (id) + DESTINATION KEY (Person2Id) REFERENCES Person (id) + LABEL Knows + ); + +query I +-DESCRIBE PROPERTY GRAPH snb; +---- +Person \ No newline at end of file From 0cacf0b22eac4098e0f08fa8101e4419f2569513 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Wed, 27 Mar 2024 18:02:52 +0100 Subject: [PATCH 02/11] Add table function --- src/duckpgq_extension.cpp | 12 +++- src/functions/tablefunctions/CMakeLists.txt | 1 + .../describe_property_graph.cpp | 65 +++++++++++++++++++ .../describe_property_graph.hpp | 50 ++++++++++++++ 4 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 src/functions/tablefunctions/describe_property_graph.cpp create mode 100644 src/include/duckpgq/functions/tablefunctions/describe_property_graph.hpp diff --git a/src/duckpgq_extension.cpp b/src/duckpgq_extension.cpp index ee83e825..3f070176 100644 --- a/src/duckpgq_extension.cpp +++ b/src/duckpgq_extension.cpp @@ -19,11 +19,13 @@ #include "duckdb/parser/statement/create_statement.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" #include "duckdb/parser/tableref/joinref.hpp" +#include "duckdb/parser/tableref/showref.hpp" #include "duckdb/parser/statement/extension_statement.hpp" #include "duckpgq/functions/tablefunctions/drop_property_graph.hpp" #include "duckpgq/functions/tablefunctions/create_property_graph.hpp" +#include "duckpgq/functions/tablefunctions/describe_property_graph.hpp" #include "duckpgq/functions/tablefunctions/match.hpp" namespace duckdb { @@ -135,6 +137,14 @@ duckpgq_handle_statement(SQLStatement *statement, DuckPGQState &duckpgq_state) { const auto select_statement = dynamic_cast(statement); const auto select_node = dynamic_cast(select_statement->node.get()); + const auto describe_node = dynamic_cast(select_node->from_table.get()); + if (describe_node) { + ParserExtensionPlanResult result; + result.function = DescribePropertyGraphFunction(); + result.requires_valid_transaction = true; + result.return_type = StatementReturnType::QUERY_RESULT; + return result; + } duckpgq_find_match_function(select_node->from_table.get(), duckpgq_state); throw Exception(ExceptionType::BINDER, "use duckpgq_bind instead"); } @@ -179,8 +189,6 @@ duckpgq_handle_statement(SQLStatement *statement, DuckPGQState &duckpgq_state) { duckpgq_state); } - // Preferably throw NotImplementedExpection here, but only BinderExceptions - // are caught properly on MacOS right now throw Exception(ExceptionType::NOT_IMPLEMENTED, StatementTypeToString(statement->type) + "has not been implemented yet for DuckPGQ queries"); } diff --git a/src/functions/tablefunctions/CMakeLists.txt b/src/functions/tablefunctions/CMakeLists.txt index 93f3d1da..9787be82 100644 --- a/src/functions/tablefunctions/CMakeLists.txt +++ b/src/functions/tablefunctions/CMakeLists.txt @@ -1,5 +1,6 @@ set(EXTENSION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/create_property_graph.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/describe_property_graph.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drop_property_graph.cpp ${CMAKE_CURRENT_SOURCE_DIR}/match.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pgq_scan.cpp diff --git a/src/functions/tablefunctions/describe_property_graph.cpp b/src/functions/tablefunctions/describe_property_graph.cpp new file mode 100644 index 00000000..420e4ab1 --- /dev/null +++ b/src/functions/tablefunctions/describe_property_graph.cpp @@ -0,0 +1,65 @@ +#include "duckpgq/functions/tablefunctions/describe_property_graph.hpp" +#include "duckdb/parser/parsed_data/create_property_graph_info.hpp" +#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" +#include "duckdb/parser/statement/create_statement.hpp" +#include "duckdb/parser/query_node/select_node.hpp" +#include "duckdb/parser/tableref/showref.hpp" +#include + +namespace duckdb { +unique_ptr +DescribePropertyGraphFunction::DescribePropertyGraphBind( + ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { + auto lookup = context.registered_state.find("duckpgq"); + if (lookup == context.registered_state.end()) { + throw Exception(ExceptionType::INVALID, + "Registered DuckPGQ state not found"); + } + const auto duckpgq_state = dynamic_cast(lookup->second.get()); + const auto duckpgq_parse_data = + dynamic_cast(duckpgq_state->parse_data.get()); + + if (!duckpgq_parse_data) { + return {}; + } + auto statement = + dynamic_cast(duckpgq_parse_data->statement.get()); + auto select_node = dynamic_cast(statement->node.get()); + auto show_ref = dynamic_cast(select_node->from_table.get()); + + auto pg_table = + duckpgq_state->registered_property_graphs.find(show_ref->table_name); + if (pg_table == duckpgq_state->registered_property_graphs.end() ) { + throw Exception(ExceptionType::INVALID, "Property graph " + show_ref->table_name + " does not exist."); + } + auto property_graph = dynamic_cast(pg_table->second.get()); + + names.emplace_back("table_name"); + return_types.emplace_back(LogicalType::VARCHAR); + + return make_uniq(property_graph); +} + +unique_ptr +DescribePropertyGraphFunction::DescribePropertyGraphInit( + ClientContext &context, TableFunctionInitInput &input) { + return make_uniq(); +} + +void DescribePropertyGraphFunction::DescribePropertyGraphFunc( + ClientContext &context, TableFunctionInput &data_p, DataChunk &output) { + auto &bind_data = data_p.bind_data->Cast(); + auto &data = data_p.global_state->Cast(); + if (data.done) { + return; + } + auto result_vector = Vector(LogicalType::VARCHAR); + auto pg_info = bind_data.describe_pg_info; + for (const auto& vertex_table : pg_info->vertex_tables) { + output.SetValue(0, 0, Value(vertex_table->table_name)); + } + output.SetCardinality(1); + data.done = true; +} +}; // namespace duckdb \ No newline at end of file diff --git a/src/include/duckpgq/functions/tablefunctions/describe_property_graph.hpp b/src/include/duckpgq/functions/tablefunctions/describe_property_graph.hpp new file mode 100644 index 00000000..d01a0d1a --- /dev/null +++ b/src/include/duckpgq/functions/tablefunctions/describe_property_graph.hpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// DuckPGQ +// +// duckpgq/functions/tablefunctions/describe_property_graph.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once +#include "duckdb/function/table_function.hpp" +#include "duckdb/parser/parsed_data/create_property_graph_info.hpp" +#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" + +namespace duckdb { + +class DescribePropertyGraphFunction : public TableFunction { +public: + DescribePropertyGraphFunction() { + name = "describe_property_graph"; + bind = DescribePropertyGraphBind; + init_global = DescribePropertyGraphInit; + function = DescribePropertyGraphFunc; + } + + struct DescribePropertyGraphBindData : public TableFunctionData { + explicit DescribePropertyGraphBindData(CreatePropertyGraphInfo *pg_info) + : describe_pg_info(pg_info) {} + CreatePropertyGraphInfo *describe_pg_info; + }; + + struct DescribePropertyGraphGlobalData : public GlobalTableFunctionState { + DescribePropertyGraphGlobalData() = default; + bool done = false; + }; + + static unique_ptr + DescribePropertyGraphBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, + vector &names); + + static unique_ptr + DescribePropertyGraphInit(ClientContext &context, + TableFunctionInitInput &input); + + static void DescribePropertyGraphFunc(ClientContext &context, + TableFunctionInput &data_p, + DataChunk &output); +}; + +} // namespace duckdb \ No newline at end of file From 0f2aba6ba092791a8973c24af3d43b54c283fa90 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Wed, 27 Mar 2024 18:02:54 +0100 Subject: [PATCH 03/11] Add table function --- duckdb-pgq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/duckdb-pgq b/duckdb-pgq index e989160f..25fd4040 160000 --- a/duckdb-pgq +++ b/duckdb-pgq @@ -1 +1 @@ -Subproject commit e989160f8384c3418be3058eaae2eab6cb121457 +Subproject commit 25fd4040712d8663a0b5606dd318741a4e1e6723 From 47d240b8b31c31ae997664228b47ff8401e3a572 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 09:48:38 +0100 Subject: [PATCH 04/11] Adding more columns --- .../describe_property_graph.cpp | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/functions/tablefunctions/describe_property_graph.cpp b/src/functions/tablefunctions/describe_property_graph.cpp index 420e4ab1..9204acc6 100644 --- a/src/functions/tablefunctions/describe_property_graph.cpp +++ b/src/functions/tablefunctions/describe_property_graph.cpp @@ -37,7 +37,14 @@ DescribePropertyGraphFunction::DescribePropertyGraphBind( names.emplace_back("table_name"); return_types.emplace_back(LogicalType::VARCHAR); - + names.emplace_back("label"); + return_types.emplace_back(LogicalType::VARCHAR); + names.emplace_back("is_vertex_table"); + return_types.emplace_back(LogicalType::BOOLEAN); + names.emplace_back("source_table"); + return_types.emplace_back(LogicalType::VARCHAR); + names.emplace_back("destination_table"); + return_types.emplace_back(LogicalType::VARCHAR); return make_uniq(property_graph); } @@ -56,10 +63,24 @@ void DescribePropertyGraphFunction::DescribePropertyGraphFunc( } auto result_vector = Vector(LogicalType::VARCHAR); auto pg_info = bind_data.describe_pg_info; + idx_t vector_idx = 0; for (const auto& vertex_table : pg_info->vertex_tables) { - output.SetValue(0, 0, Value(vertex_table->table_name)); + output.SetValue(0, vector_idx, Value(vertex_table->table_name)); + output.SetValue(1, vector_idx, Value(vertex_table->main_label)); + output.SetValue(2, vector_idx, Value(vertex_table->is_vertex_table)); + output.SetValue(3, vector_idx, Value()); + output.SetValue(4, vector_idx, Value()); + vector_idx++; + } + for (const auto& edge_table : pg_info->edge_tables) { + output.SetValue(0, vector_idx, Value(edge_table->table_name)); + output.SetValue(1, vector_idx, Value(edge_table->main_label)); + output.SetValue(2, vector_idx, Value(edge_table->is_vertex_table)); + output.SetValue(3, vector_idx, Value(edge_table->source_reference)); + output.SetValue(4, vector_idx, Value(edge_table->destination_reference)); + vector_idx++; } - output.SetCardinality(1); + output.SetCardinality(vector_idx); data.done = true; } }; // namespace duckdb \ No newline at end of file From 84ed67c019b8992b0e92d3472167066e922bd468 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 09:49:32 +0100 Subject: [PATCH 05/11] Remove result_vector --- src/functions/tablefunctions/describe_property_graph.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/functions/tablefunctions/describe_property_graph.cpp b/src/functions/tablefunctions/describe_property_graph.cpp index 9204acc6..e91efcff 100644 --- a/src/functions/tablefunctions/describe_property_graph.cpp +++ b/src/functions/tablefunctions/describe_property_graph.cpp @@ -61,7 +61,6 @@ void DescribePropertyGraphFunction::DescribePropertyGraphFunc( if (data.done) { return; } - auto result_vector = Vector(LogicalType::VARCHAR); auto pg_info = bind_data.describe_pg_info; idx_t vector_idx = 0; for (const auto& vertex_table : pg_info->vertex_tables) { From 5f307ad3cf6b451c233cd476ee2e64a0eb2e2ddf Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 10:10:17 +0100 Subject: [PATCH 06/11] Added source/destination pk/fk --- .../describe_property_graph.cpp | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/functions/tablefunctions/describe_property_graph.cpp b/src/functions/tablefunctions/describe_property_graph.cpp index e91efcff..522bf2d6 100644 --- a/src/functions/tablefunctions/describe_property_graph.cpp +++ b/src/functions/tablefunctions/describe_property_graph.cpp @@ -43,8 +43,16 @@ DescribePropertyGraphFunction::DescribePropertyGraphBind( return_types.emplace_back(LogicalType::BOOLEAN); names.emplace_back("source_table"); return_types.emplace_back(LogicalType::VARCHAR); + names.emplace_back("source_pk"); + return_types.emplace_back(LogicalType::LIST(LogicalType::VARCHAR)); + names.emplace_back("source_fk"); + return_types.emplace_back(LogicalType::LIST(LogicalType::VARCHAR)); names.emplace_back("destination_table"); return_types.emplace_back(LogicalType::VARCHAR); + names.emplace_back("destination_pk"); + return_types.emplace_back(LogicalType::LIST(LogicalType::VARCHAR)); + names.emplace_back("destination_fk"); + return_types.emplace_back(LogicalType::LIST(LogicalType::VARCHAR)); return make_uniq(property_graph); } @@ -69,6 +77,10 @@ void DescribePropertyGraphFunction::DescribePropertyGraphFunc( output.SetValue(2, vector_idx, Value(vertex_table->is_vertex_table)); output.SetValue(3, vector_idx, Value()); output.SetValue(4, vector_idx, Value()); + output.SetValue(5, vector_idx, Value()); + output.SetValue(6, vector_idx, Value()); + output.SetValue(7, vector_idx, Value()); + output.SetValue(8, vector_idx, Value()); vector_idx++; } for (const auto& edge_table : pg_info->edge_tables) { @@ -76,7 +88,27 @@ void DescribePropertyGraphFunction::DescribePropertyGraphFunc( output.SetValue(1, vector_idx, Value(edge_table->main_label)); output.SetValue(2, vector_idx, Value(edge_table->is_vertex_table)); output.SetValue(3, vector_idx, Value(edge_table->source_reference)); - output.SetValue(4, vector_idx, Value(edge_table->destination_reference)); + vector source_pk_list; + for (const auto& col : edge_table->source_pk) { + source_pk_list.push_back(Value(col)); + } + output.SetValue(4, vector_idx, Value::LIST(LogicalType::VARCHAR,source_pk_list)); + vector source_fk_list; + for (const auto& col : edge_table->source_fk) { + source_fk_list.push_back(Value(col)); + } + output.SetValue(5, vector_idx, Value::LIST(LogicalType::VARCHAR,source_fk_list)); + output.SetValue(6, vector_idx, Value(edge_table->destination_reference)); + vector destination_pk_list; + for (const auto& col : edge_table->destination_pk) { + destination_pk_list.push_back(Value(col)); + } + output.SetValue(7, vector_idx, Value::LIST(LogicalType::VARCHAR,destination_pk_list)); + vector destination_fk_list; + for (const auto& col : edge_table->destination_fk) { + destination_fk_list.push_back(Value(col)); + } + output.SetValue(8, vector_idx, Value::LIST(LogicalType::VARCHAR,destination_fk_list)); vector_idx++; } output.SetCardinality(vector_idx); From 445da9a09cb158dfd0aa0c68c17c5c77fb3abf05 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 10:10:33 +0100 Subject: [PATCH 07/11] remove unneeded import --- src/functions/tablefunctions/describe_property_graph.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/functions/tablefunctions/describe_property_graph.cpp b/src/functions/tablefunctions/describe_property_graph.cpp index 522bf2d6..566d1682 100644 --- a/src/functions/tablefunctions/describe_property_graph.cpp +++ b/src/functions/tablefunctions/describe_property_graph.cpp @@ -1,6 +1,5 @@ #include "duckpgq/functions/tablefunctions/describe_property_graph.hpp" #include "duckdb/parser/parsed_data/create_property_graph_info.hpp" -#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" #include "duckdb/parser/statement/create_statement.hpp" #include "duckdb/parser/query_node/select_node.hpp" #include "duckdb/parser/tableref/showref.hpp" From 17e8756a9f107519151ffc1b8e43656eb9ffe147 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 10:14:20 +0100 Subject: [PATCH 08/11] Adding discriminator columns --- .../describe_property_graph.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/functions/tablefunctions/describe_property_graph.cpp b/src/functions/tablefunctions/describe_property_graph.cpp index 566d1682..7e494def 100644 --- a/src/functions/tablefunctions/describe_property_graph.cpp +++ b/src/functions/tablefunctions/describe_property_graph.cpp @@ -52,6 +52,12 @@ DescribePropertyGraphFunction::DescribePropertyGraphBind( return_types.emplace_back(LogicalType::LIST(LogicalType::VARCHAR)); names.emplace_back("destination_fk"); return_types.emplace_back(LogicalType::LIST(LogicalType::VARCHAR)); + names.emplace_back("discriminator"); + return_types.emplace_back(LogicalType::VARCHAR); + names.emplace_back("sub_labels"); + return_types.emplace_back(LogicalType::LIST(LogicalType::VARCHAR)); + + return make_uniq(property_graph); } @@ -80,6 +86,17 @@ void DescribePropertyGraphFunction::DescribePropertyGraphFunc( output.SetValue(6, vector_idx, Value()); output.SetValue(7, vector_idx, Value()); output.SetValue(8, vector_idx, Value()); + if (!vertex_table->discriminator.empty()) { + output.SetValue(9, vector_idx, Value(vertex_table->discriminator)); + vector sub_labels; + for (const auto& label : vertex_table->sub_labels) { + sub_labels.push_back(Value(label)); + } + output.SetValue(10, vector_idx, Value::LIST(LogicalType::VARCHAR, sub_labels)); + } else { + output.SetValue(9, vector_idx, Value()); + output.SetValue(10, vector_idx, Value()); + } vector_idx++; } for (const auto& edge_table : pg_info->edge_tables) { @@ -108,6 +125,17 @@ void DescribePropertyGraphFunction::DescribePropertyGraphFunc( destination_fk_list.push_back(Value(col)); } output.SetValue(8, vector_idx, Value::LIST(LogicalType::VARCHAR,destination_fk_list)); + if (!edge_table->discriminator.empty()) { + output.SetValue(9, vector_idx, Value(edge_table->discriminator)); + vector sub_labels; + for (const auto& label : edge_table->sub_labels) { + sub_labels.push_back(Value(label)); + } + output.SetValue(10, vector_idx, Value::LIST(LogicalType::VARCHAR, sub_labels)); + } else { + output.SetValue(9, vector_idx, Value()); + output.SetValue(10, vector_idx, Value()); + } vector_idx++; } output.SetCardinality(vector_idx); From bb3e108a173f7226be671431687a35ff6ce6a339 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 10:15:11 +0100 Subject: [PATCH 09/11] Update test --- test/sql/create_pg/describe_pg.test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/sql/create_pg/describe_pg.test b/test/sql/create_pg/describe_pg.test index f0be3d0f..bde31647 100644 --- a/test/sql/create_pg/describe_pg.test +++ b/test/sql/create_pg/describe_pg.test @@ -17,7 +17,8 @@ EDGE TABLES ( LABEL Knows ); -query I +query IIIIIIIIIII -DESCRIBE PROPERTY GRAPH snb; ---- -Person \ No newline at end of file +Person person true NULL NULL NULL NULL NULL NULL NULL NULL +Person_knows_person knows false Person [id] [Person1Id] Person [id] [Person2Id] NULL NULL \ No newline at end of file From 2f1cc84d2ddfcd1ace608e8e5991af438899a4de Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 10:17:01 +0100 Subject: [PATCH 10/11] Add larger property graph --- test/sql/create_pg/describe_pg.test | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/test/sql/create_pg/describe_pg.test b/test/sql/create_pg/describe_pg.test index bde31647..6afab78b 100644 --- a/test/sql/create_pg/describe_pg.test +++ b/test/sql/create_pg/describe_pg.test @@ -21,4 +21,69 @@ query IIIIIIIIIII -DESCRIBE PROPERTY GRAPH snb; ---- Person person true NULL NULL NULL NULL NULL NULL NULL NULL +Person_knows_person knows false Person [id] [Person1Id] Person [id] [Person2Id] NULL NULL + +statement ok +-CREATE OR REPLACE PROPERTY GRAPH snb +VERTEX TABLES ( + Person LABEL Person, + Forum LABEL Forum, + Organisation LABEL Organisation IN typemask(company, university), + Place LABEL Place, + Tag LABEL Tag, + TagClass LABEL TagClass, + Country LABEL Country, + City LABEL City, + Message LABEL Message + ) +EDGE TABLES ( + Person_knows_person SOURCE KEY (Person1Id) REFERENCES Person (id) + DESTINATION KEY (Person2Id) REFERENCES Person (id) + LABEL Knows, + Forum_hasMember_Person SOURCE KEY (ForumId) REFERENCES Forum (id) + DESTINATION KEY (PersonId) REFERENCES Person (id) + LABEL hasMember, + Forum_hasTag_Tag SOURCE KEY (ForumId) REFERENCES Forum (id) + DESTINATION KEY (TagId) REFERENCES Tag (id) + LABEL Forum_hasTag, + Person_hasInterest_Tag SOURCE KEY (PersonId) REFERENCES Person (id) + DESTINATION KEY (TagId) REFERENCES Tag (id) + LABEL hasInterest, + person_workAt_Organisation SOURCE KEY (PersonId) REFERENCES Person (id) + DESTINATION KEY (OrganisationId) REFERENCES Organisation (id) + LABEL workAt_Organisation, + Person_likes_Message SOURCE KEY (PersonId) REFERENCES Person (id) + DESTINATION KEY (id) REFERENCES Message (id) + LABEL likes_Message, + Message_hasTag_Tag SOURCE KEY (id) REFERENCES Message (id) + DESTINATION KEY (TagId) REFERENCES Tag (id) + LABEL message_hasTag, + Message_hasAuthor_Person SOURCE KEY (messageId) REFERENCES Message (id) + DESTINATION KEY (PersonId) REFERENCES Person (id) + LABEL hasAuthor, + Message_replyOf_Message SOURCE KEY (messageId) REFERENCES Message (id) + DESTINATION KEY (ParentMessageId) REFERENCES Message (id) + LABEL replyOf + ); + +query IIIIIIIIIII +-DESCRIBE PROPERTY GRAPH snb; +---- +Message message true NULL NULL NULL NULL NULL NULL NULL NULL +City city true NULL NULL NULL NULL NULL NULL NULL NULL +Country country true NULL NULL NULL NULL NULL NULL NULL NULL +TagClass tagclass true NULL NULL NULL NULL NULL NULL NULL NULL +Tag tag true NULL NULL NULL NULL NULL NULL NULL NULL +Place place true NULL NULL NULL NULL NULL NULL NULL NULL +Organisation organisation true NULL NULL NULL NULL NULL NULL typemask [company, university] +Forum forum true NULL NULL NULL NULL NULL NULL NULL NULL +Person person true NULL NULL NULL NULL NULL NULL NULL NULL +Message_replyOf_Message replyof false Message [id] [messageId] Message [id] [ParentMessageId] NULL NULL +Message_hasAuthor_Person hasauthor false Message [id] [messageId] Person [id] [PersonId] NULL NULL +Message_hasTag_Tag message_hastag false Message [id] [id] Tag [id] [TagId] NULL NULL +Person_likes_Message likes_message false Person [id] [PersonId] Message [id] [id] NULL NULL +person_workAt_Organisation workat_organisation false Person [id] [PersonId] Organisation [id] [OrganisationId] NULL NULL +Person_hasInterest_Tag hasinterest false Person [id] [PersonId] Tag [id] [TagId] NULL NULL +Forum_hasTag_Tag forum_hastag false Forum [id] [ForumId] Tag [id] [TagId] NULL NULL +Forum_hasMember_Person hasmember false Forum [id] [ForumId] Person [id] [PersonId] NULL NULL Person_knows_person knows false Person [id] [Person1Id] Person [id] [Person2Id] NULL NULL \ No newline at end of file From 65e40253949306968c171fef79f414e19ebc01f2 Mon Sep 17 00:00:00 2001 From: dtenwolde Date: Thu, 28 Mar 2024 10:31:40 +0100 Subject: [PATCH 11/11] Adding test case where pg does not exist --- test/sql/create_pg/describe_pg.test | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/sql/create_pg/describe_pg.test b/test/sql/create_pg/describe_pg.test index 6afab78b..4f9ff345 100644 --- a/test/sql/create_pg/describe_pg.test +++ b/test/sql/create_pg/describe_pg.test @@ -86,4 +86,9 @@ person_workAt_Organisation workat_organisation false Person [id] [PersonId] Orga Person_hasInterest_Tag hasinterest false Person [id] [PersonId] Tag [id] [TagId] NULL NULL Forum_hasTag_Tag forum_hastag false Forum [id] [ForumId] Tag [id] [TagId] NULL NULL Forum_hasMember_Person hasmember false Forum [id] [ForumId] Person [id] [PersonId] NULL NULL -Person_knows_person knows false Person [id] [Person1Id] Person [id] [Person2Id] NULL NULL \ No newline at end of file +Person_knows_person knows false Person [id] [Person1Id] Person [id] [Person2Id] NULL NULL + +statement error +-DESCRIBE PROPERTY GRAPH pgdoesnotexist; +---- +Invalid Error: Property graph pgdoesnotexist does not exist. \ No newline at end of file