Changeset: 7a735b486829 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7a735b486829
Modified Files:
        sql/backends/monet5/sql_upgrades.c
        sql/test/emptydb/Tests/check.SQL.py
Branch: Dec2025
Log Message:

Make it easier to check upgrades by hand.


diffs (81 lines):

diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -375,6 +375,16 @@ sql_drop_shp(Client c)
        return SQLstatementIntern(c, query, "update", true, false, NULL);
 }
 
+
+static str
+sql_update_generator(Client c)
+{
+       static const char query[] =
+               "update sys.args set name = 'limit' where name = 'last' and 
func_id in (select id from sys.functions where schema_id = 2000 and name = 
'generate_series' and func like '% last %');\n"
+               "update sys.functions set func = replace(func, ' last ', ' 
\"limit\" ') where schema_id = 2000 and name = 'generate_series' and func like 
'% last %';\n";
+       return SQLstatementIntern(c, query, "update", true, false, NULL);
+}
+
 static str
 sql_update_jan2022(Client c, mvc *sql)
 {
@@ -5385,6 +5395,10 @@ SQLupgrades(Client c, mvc *m)
        }
 #endif
 
+       if ((err = sql_update_generator(c)) != NULL) {
+               goto handle_error;
+       }
+
        if ((err = sql_update_jan2022(c, m)) != NULL) {
                goto handle_error;
        }
diff --git a/sql/test/emptydb/Tests/check.SQL.py 
b/sql/test/emptydb/Tests/check.SQL.py
--- a/sql/test/emptydb/Tests/check.SQL.py
+++ b/sql/test/emptydb/Tests/check.SQL.py
@@ -11,6 +11,8 @@ user = 'monetdb'
 passwd = 'monetdb'
 approve = None
 check = None
+stableout = 'check.stable.out.32bit' if os.getenv('TST_BITS', '') == '32bit' 
else 'check.stable.out.int128' if os.getenv('HAVE_HGE') else 'check.stable.out'
+
 if __name__ == '__main__':
     import argparse
     parser = argparse.ArgumentParser(description='Run check queries on a 
database')
@@ -24,11 +26,17 @@ if __name__ == '__main__':
                         help='user name to login to the database with')
     parser.add_argument('--password', action='store', default=passwd,
                         help='password to use to login to the database with')
-    parser.add_argument('--approve', action='store', default=approve,
+    xgroup = parser.add_argument_group(title='at most one of these')
+    rgroup = xgroup.add_mutually_exclusive_group()
+    rgroup.add_argument('--approve', action='store', default=approve,
                         type=argparse.FileType('w'),
                         help='file in which to produce a new .test file '
                         'with updated results')
-    parser.add_argument('check', nargs='*', help='name of test')
+    rgroup.add_argument('--stableout', action='store', default=None,
+                        help='stable output to compare against '
+                        '(implies check mode)')
+    parser.add_argument('check', nargs='*', help='name of test '
+                        '(implies check mode, ignored if --approve)')
     opts = parser.parse_args()
     port = opts.port
     dbname = opts.database
@@ -37,6 +45,9 @@ if __name__ == '__main__':
     passwd = opts.password
     approve = opts.approve
     check = opts.check
+    if opts.stableout is not None:
+        stableout = opts.stableout
+        check = True
 
 xit = 0
 output = []
@@ -586,7 +597,6 @@ with process.client('sql', interactive=T
 
 if check:
     output = ''.join(output).splitlines(keepends=True)
-    stableout = 'check.stable.out.32bit' if os.getenv('TST_BITS', '') == 
'32bit' else 'check.stable.out.int128' if os.getenv('HAVE_HGE') else 
'check.stable.out'
     with open(stableout) as fil:
         stable = fil.readlines()
     import difflib
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to