Changeset: 4b28ef546af2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4b28ef546af2
Modified Files:
        clients/mapiclient/dump.c
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/97_comments.sql
Branch: Mar2018
Log Message:

Inline view commented_function_signatures into dump.c


diffs (87 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1307,9 +1307,20 @@ dump_function_comment(Mapi mid, stream *
                return 1;
 
        snprintf(query, len,
-               "SELECT category, schema, name, type, type_digits, type_scale, 
remark "
-               "FROM sys.commented_function_signatures "
-               "WHERE fid = %s "
+               "SELECT \n"
+               "        sys.function_type_keyword(f.type) AS category,\n"
+               "        s.name AS schema,\n"
+               "        CASE RANK() OVER (PARTITION BY f.id ORDER BY p.number 
ASC) WHEN 1 THEN f.name ELSE NULL END AS name,\n"
+               "        p.type, \n"
+               "        p.type_digits, \n"
+               "        p.type_scale,\n"
+               "        CASE RANK() OVER (PARTITION BY f.id ORDER BY p.number 
DESC) WHEN 1 THEN c.remark ELSE NULL END AS remark,\n"
+               "        ROW_NUMBER() OVER (ORDER BY f.id, p.number) AS line\n"
+               "FROM sys.functions f\n"
+               "JOIN sys.comments c ON f.id = c.id\n"
+               "JOIN sys.schemas s ON f.schema_id = s.id\n"
+               "LEFT OUTER JOIN sys.args p ON f.id = p.func_id AND p.inout = 
1\n"
+               "WHERE f.id = %s\n"
                "ORDER BY line;", id);
 
        hashge = has_hugeint(mid);
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
@@ -1328,27 +1328,10 @@ sql_update_mar2018(Client c, mvc *sql)
                        "                ELSE 'ROUTINE'\n"
                        "        END;\n"
                        "END;\n"
-                       "GRANT EXECUTE ON FUNCTION 
sys.function_type_keyword(INT) TO PUBLIC;\n"                 
-                       "CREATE VIEW sys.commented_function_signatures AS\n"
-                       "SELECT f.id AS fid,\n"
-                       "       s.name AS schema,\n"
-                       "       f.name AS fname,\n"
-                       "       sys.function_type_keyword(f.type) AS 
category,\n"
-                       "       sf.function_id IS NOT NULL AS system,\n"
-                       "       CASE RANK() OVER (PARTITION BY f.id ORDER BY 
p.number ASC) WHEN 1 THEN f.name ELSE NULL END AS name,\n"
-                       "       CASE RANK() OVER (PARTITION BY f.id ORDER BY 
p.number DESC) WHEN 1 THEN c.remark ELSE NULL END AS remark,\n"
-                       "       p.type, p.type_digits, p.type_scale,\n"
-                       "       ROW_NUMBER() OVER (ORDER BY f.id, p.number) AS 
line\n"
-                       "  FROM sys.functions f\n"
-                       "  JOIN sys.comments c ON f.id = c.id\n"
-                       "  JOIN sys.schemas s ON f.schema_id = s.id\n"
-                       "  LEFT OUTER JOIN sys.systemfunctions sf ON f.id = 
sf.function_id\n"
-                       "  LEFT OUTER JOIN sys.args p ON f.id = p.func_id AND 
p.inout = 1\n"
-                       " ORDER BY line;\n"
-                       "GRANT SELECT ON sys.commented_function_signatures TO 
PUBLIC;\n"
+                       "GRANT EXECUTE ON FUNCTION 
sys.function_type_keyword(INT) TO PUBLIC;\n" 
                        "UPDATE sys._tables\n"
                        "SET system = true\n"
-                       "WHERE name IN ('comments', 
'commented_function_signatures')\n"
+                       "WHERE name = 'comments'\n"
                        "AND schema_id = (SELECT id FROM sys.schemas WHERE name 
= 'sys');\n"
                        "DELETE FROM sys.systemfunctions WHERE function_id IS 
NULL;\n"
                        "ALTER TABLE sys.systemfunctions ALTER COLUMN 
function_id SET NOT NULL;\n"
diff --git a/sql/scripts/97_comments.sql b/sql/scripts/97_comments.sql
--- a/sql/scripts/97_comments.sql
+++ b/sql/scripts/97_comments.sql
@@ -8,23 +8,3 @@
 -- in sys.describe_all_objects and sys.commented_function_signatures defined 
below.
 CREATE TABLE sys.systemfunctions (function_id INTEGER NOT NULL);
 GRANT SELECT ON sys.systemfunctions TO PUBLIC;
-
-
-CREATE VIEW sys.commented_function_signatures AS
-SELECT f.id AS fid,
-       s.name AS schema,
-       f.name AS fname,
-       sys.function_type_keyword(f.type) AS category,
-       sf.function_id IS NOT NULL AS system,
-       CASE RANK() OVER (PARTITION BY f.id ORDER BY p.number ASC) WHEN 1 THEN 
f.name ELSE NULL END AS name,
-       CASE RANK() OVER (PARTITION BY f.id ORDER BY p.number DESC) WHEN 1 THEN 
c.remark ELSE NULL END AS remark,
-       p.type, p.type_digits, p.type_scale,
-       ROW_NUMBER() OVER (ORDER BY f.id, p.number) AS line
-  FROM sys.functions f
-  JOIN sys.comments c ON f.id = c.id
-  JOIN sys.schemas s ON f.schema_id = s.id
-  LEFT OUTER JOIN sys.systemfunctions sf ON f.id = sf.function_id
-  LEFT OUTER JOIN sys.args p ON f.id = p.func_id AND p.inout = 1
- ORDER BY line;
-GRANT SELECT ON sys.commented_function_signatures TO PUBLIC;
-
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to