Changeset: 19c325991287 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=19c325991287
Modified Files:
        sql/backends/monet5/sql_scenario.c
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
Branch: Oct2014
Log Message:

Use qualified table names in upgrade code, and approve upgrade output.


diffs (56 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -872,17 +872,17 @@ sql_update_oct2014_2(Client c)
        int recreate = 0;
 
        /* get list of all foreign keys */
-       pos += snprintf(buf + pos, bufsize - pos, "SELECT fs.name, ft.name, 
fk.name, fk.\"action\", ps.name, pt.name FROM keys fk, tables ft, schemas fs, 
keys pk, tables pt, schemas ps WHERE fk.type = 2 AND (SELECT count(*) FROM 
objects o WHERE o.id = fk.id) > 1 AND ft.id = fk.table_id AND ft.schema_id = 
fs.id AND fk.rkey = pk.id AND pk.table_id = pt.id AND pt.schema_id = ps.id;\n");
+       pos += snprintf(buf + pos, bufsize - pos, "SELECT fs.name, ft.name, 
fk.name, fk.\"action\", ps.name, pt.name FROM sys.keys fk, sys.tables ft, 
sys.schemas fs, sys.keys pk, sys.tables pt, sys.schemas ps WHERE fk.type = 2 
AND (SELECT count(*) FROM sys.objects o WHERE o.id = fk.id) > 1 AND ft.id = 
fk.table_id AND ft.schema_id = fs.id AND fk.rkey = pk.id AND pk.table_id = 
pt.id AND pt.schema_id = ps.id;\n");
        err = SQLstatementIntern(c, &buf, "update", 1, 0, &fresult);
 
        /* get all primary/unique keys */
        pos = 0;
-       pos += snprintf(buf + pos, bufsize - pos, "SELECT s.name, t.name, 
k.name, k.type FROM keys k, tables t, schemas s WHERE k.type < 2 AND (SELECT 
count(*) FROM objects o WHERE o.id = k.id) > 1 AND t.id = k.table_id AND 
t.schema_id = s.id;\n");
+       pos += snprintf(buf + pos, bufsize - pos, "SELECT s.name, t.name, 
k.name, k.type FROM sys.keys k, sys.tables t, sys.schemas s WHERE k.type < 2 
AND (SELECT count(*) FROM sys.objects o WHERE o.id = k.id) > 1 AND t.id = 
k.table_id AND t.schema_id = s.id;\n");
        err = SQLstatementIntern(c, &buf, "update", 1, 0, &presult);
 
        /* get indices */
        pos = 0;
-       pos += snprintf(buf + pos, bufsize - pos, "SELECT s.name, t.name, 
i.name FROM idxs i, schemas s, tables t WHERE i.table_id = t.id AND t.schema_id 
= s.id AND t.system = FALSE AND (SELECT count(*) FROM objects o WHERE o.id = 
i.id) > 1;\n");
+       pos += snprintf(buf + pos, bufsize - pos, "SELECT s.name, t.name, 
i.name FROM sys.idxs i, sys.schemas s, sys.tables t WHERE i.table_id = t.id AND 
t.schema_id = s.id AND t.system = FALSE AND (SELECT count(*) FROM sys.objects o 
WHERE o.id = i.id) > 1;\n");
        err = SQLstatementIntern(c, &buf, "update", 1, 0, &iresult);
 
        if (fresult) {
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
@@ -173,6 +173,12 @@ insert into sys.systemfunctions (select 
 set schema "testschema";
 
 #Interpreting bte as bit.
+Running database upgrade commands:
+ALTER table "testschema"."keytest1" ADD CONSTRAINT "keytest1_key1_key2_pkey" 
PRIMARY KEY ("key1", "key2");
+
+Running database upgrade commands:
+ALTER table "testschema"."keytest2" ADD CONSTRAINT "keytest2_key1_key2_fkey" 
FOREIGN KEY ("key1", "key2") REFERENCES "testschema"."keytest1" ("key1", 
"key2") ;
+
 
 # 15:12:32 >  
 # 15:12:32 >  "/usr/bin/python2" "upgrade.SQL.py" "upgrade"
diff --git a/sql/test/testdb-upgrade/Tests/upgrade.stable.out 
b/sql/test/testdb-upgrade/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/testdb-upgrade/Tests/upgrade.stable.out
@@ -170,6 +170,12 @@ insert into sys.systemfunctions (select 
 set schema "testschema";
 
 #Interpreting bte as bit.
+Running database upgrade commands:
+ALTER table "testschema"."keytest1" ADD CONSTRAINT "keytest1_key1_key2_pkey" 
PRIMARY KEY ("key1", "key2");
+
+Running database upgrade commands:
+ALTER table "testschema"."keytest2" ADD CONSTRAINT "keytest2_key1_key2_fkey" 
FOREIGN KEY ("key1", "key2") REFERENCES "testschema"."keytest1" ("key1", 
"key2") ;
+
 
 # 15:08:13 >  
 # 15:08:13 >  "/usr/bin/python2" "upgrade.SQL.py" "upgrade"
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to