Changeset: 979607d2397e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/979607d2397e
Modified Files:
        sql/scripts/52_describe.sql
        sql/scripts/76_dump.sql
Branch: default
Log Message:

Some more fixes to the dump code.
Dump constraints on all types of tables (specifically also merge
tables);
Fix double negation in describe_comments;
Dump table data before adding constraints and initializing sequences.


diffs (47 lines):

diff --git a/sql/scripts/52_describe.sql b/sql/scripts/52_describe.sql
--- a/sql/scripts/52_describe.sql
+++ b/sql/scripts/52_describe.sql
@@ -169,8 +169,7 @@ CREATE VIEW sys.describe_constraints AS
                AND k.table_id = t.id
                AND s.id = t.schema_id
                AND t.system = FALSE
-               AND k.type in (0, 1)
-               AND t.type IN (0, 6);
+               AND k.type in (0, 1);
 
 CREATE VIEW sys.describe_indices AS
        WITH it (id, idx) AS (VALUES (0, 'INDEX'), (4, 'IMPRINTS INDEX'), (5, 
'ORDERED INDEX')) --UNIQUE INDEX wraps to INDEX.
@@ -333,7 +332,7 @@ CREATE VIEW sys.describe_comments AS
 
                        SELECT t.id, CASE WHEN ts.table_type_name = 'VIEW' THEN 
'VIEW' ELSE 'TABLE' END, sys.FQN(s.name, t.name)
                        FROM sys.schemas s JOIN sys.tables t ON s.id = 
t.schema_id JOIN sys.table_types ts ON t.type = ts.table_type_id
-                       WHERE NOT s.name <> 'tmp'
+                       WHERE s.name <> 'tmp'
 
                        UNION ALL
 
diff --git a/sql/scripts/76_dump.sql b/sql/scripts/76_dump.sql
--- a/sql/scripts/76_dump.sql
+++ b/sql/scripts/76_dump.sql
@@ -354,6 +354,11 @@ BEGIN
                                      SELECT t.o, t.stmt FROM sys.dump_tables t
                                    ) AS stmts(o, s);
 
+  -- dump table data before adding constraints and fixing sequences
+  IF NOT DESCRIBE THEN
+    CALL sys.dump_table_data();
+  END IF;
+
   INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM 
sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_start_sequences;
   INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM 
sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_column_defaults;
   INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM 
sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_table_constraint_type;
@@ -366,9 +371,6 @@ BEGIN
   INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM 
sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_column_grants;
   INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM 
sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_function_grants;
 
-  IF NOT DESCRIBE THEN
-    CALL sys.dump_table_data();
-  END IF;
   --TODO Improve performance of dump_table_data.
   --TODO loaders ,procedures, window and filter sys.functions.
   --TODO look into order dependent group_concat
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to