generated from duckdb/extension-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into 67-shortest-path-bounded
- Loading branch information
Showing
5 changed files
with
137 additions
and
3 deletions.
There are no files selected for viewing
Submodule duckdb-pgq
updated
4 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# name: test/sql/sqlpgq/snb.test | ||
# group: [duckpgq] | ||
|
||
require duckpgq | ||
|
||
statement ok | ||
from duckdb_columns; | ||
|
||
statement ok | ||
from duckdb_constraints(); | ||
|
||
statement ok | ||
select * from information_schema.columns; | ||
|
||
statement ok | ||
select * from information_schema.tables; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# https://github.com/cwida/duckpgq-extension/issues/95 | ||
# name: test/sql/sqlpgq/non_existing_table.test | ||
# group: [sqlpgq] | ||
|
||
require duckpgq | ||
|
||
# https://github.com/cwida/duckpgq-extension/issues/96 | ||
statement error | ||
select * from table_that_does_not_exist; | ||
---- | ||
Catalog Error: Table with name table_that_does_not_exist does not exist! | ||
|
||
statement ok | ||
CREATE TABLE test (a INTEGER); | ||
|
||
statement error | ||
SELECT b from test; | ||
---- | ||
Binder Error: Referenced column "b" not found in FROM clause! | ||
|
||
statement ok | ||
import database 'duckdb-pgq/data/SNB0.003'; | ||
|
||
statement ok | ||
-CREATE PROPERTY GRAPH snb | ||
VERTEX TABLES ( | ||
Person, | ||
Organisation IN typemask(company, university) | ||
) | ||
EDGE TABLES ( | ||
Person_knows_person SOURCE KEY (Person1Id) REFERENCES Person (id) | ||
DESTINATION KEY (Person2Id) REFERENCES Person (id) | ||
LABEL Knows, | ||
person_workAt_Organisation SOURCE KEY (PersonId) REFERENCES Person (id) | ||
DESTINATION KEY (OrganisationId) REFERENCES Organisation (id) | ||
LABEL workAt_Organisation | ||
); | ||
|
||
statement error | ||
-FROM GRAPH_TABLE (snb | ||
MATCH (a:Kind) | ||
COLUMNS (*) | ||
); | ||
---- | ||
Binder Error: The label kind is not registered in property graph snb | ||
|
||
statement error | ||
-FROM GRAPH_TABLE (abc | ||
MATCH (a:Kind) | ||
COLUMNS (*) | ||
); | ||
---- | ||
Binder Error: Property graph abc does not exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# name: test/sql/sqlpgq/snb.test | ||
# group: [duckpgq] | ||
|
||
require duckpgq | ||
|
||
#statement ok | ||
#select 1 source; | ||
|
||
statement ok | ||
FROM duckdb_constraints() | ||
|
||
statement ok | ||
SELECT | ||
*, | ||
regexp_extract(constraint_text, 'FOREIGN KEY \\(([a-zA-Z_0-9]+)\\) REFERENCES ([a-zA-Z_0-9]+)\\(([a-zA-Z_0-9]+)\\)', ['source', 'target', 'target_column']) AS name_extract | ||
FROM duckdb_constraints() | ||
WHERE constraint_type = 'FOREIGN KEY' | ||
|
||
statement ok | ||
SELECT | ||
*, | ||
name_extract['source'] AS source, | ||
name_extract['target'] AS target, | ||
name_extract['target_column'] AS target_column | ||
FROM ( | ||
SELECT | ||
*, | ||
regexp_extract(constraint_text, 'FOREIGN KEY \\(([a-zA-Z_0-9]+)\\) REFERENCES ([a-zA-Z_0-9]+)\\(([a-zA-Z_0-9]+)\\)', ['source', 'target', 'target_column']) AS name_extract | ||
FROM duckdb_constraints() | ||
WHERE constraint_type = 'FOREIGN KEY' | ||
); | ||
|
||
|
||
statement ok | ||
SELECT | ||
f.database_name AS constraint_catalog, | ||
f.schema_name AS constraint_schema, | ||
CONCAT(f.source, '_', f.target, '_', f.target_column, '_fkey') AS constraint_name, | ||
current_database() AS unique_constraint_catalog, | ||
c.schema_name AS unique_constraint_schema, | ||
CONCAT(c.table_name, '_', f.target_column, '_', | ||
CASE WHEN c.constraint_type = 'UNIQUE' THEN 'key' ELSE 'pkey' END) AS unique_constraint_name, | ||
'NONE' AS match_option, | ||
'NO ACTION' AS update_rule, | ||
'NO ACTION' AS delete_rule | ||
FROM duckdb_constraints() c | ||
JOIN ( | ||
SELECT | ||
*, | ||
name_extract['source'] AS source, | ||
name_extract['target'] AS target, | ||
name_extract['target_column'] AS target_column | ||
FROM ( | ||
SELECT | ||
*, | ||
regexp_extract(constraint_text, 'FOREIGN KEY \\(([a-zA-Z_0-9]+)\\) REFERENCES ([a-zA-Z_0-9]+)\\(([a-zA-Z_0-9]+)\\)', ['source', 'target', 'target_column']) AS name_extract | ||
FROM duckdb_constraints() | ||
WHERE constraint_type = 'FOREIGN KEY' | ||
) | ||
) f ON name_extract['target'] = c.table_name | ||
AND (c.constraint_type = 'UNIQUE' OR c.constraint_type = 'PRIMARY KEY'); | ||
|
||
|
||
statement ok | ||
FROM information_schema.tables; |