Changeset: b39007f54276 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b39007f54276 Modified Files: sql/ChangeLog.Aug2024 sql/backends/monet5/sql_upgrades.c sql/scripts/22_clients.sql Branch: Aug2024 Log Message:
Improve definition of table sys.clientinfo_properties. As this is static data, also set it to read only. Also added grant select on this table to public, as the procedure sys.setclientinfo(property string, value string) also is granted to public. Updated the upgrade code. Also added missing info in the ChangeLog, so it gets into the release notes. diffs (86 lines): diff --git a/sql/ChangeLog.Aug2024 b/sql/ChangeLog.Aug2024 --- a/sql/ChangeLog.Aug2024 +++ b/sql/ChangeLog.Aug2024 @@ -5,6 +5,16 @@ - Extend CREATE USER MAX_MEMORY and ALTER USER MAX_MEMORY to accept strings of the form '10MiB', '10G', etc. +* Wed May 29 2024 Joeri van Ruth <joeri.van.r...@monetdbsolutions.com> +- Extended view sys.sessions and function sys.sessions() with new columns: + language, peer, hostname, application, client, clientpid and remark. +- Added procedure sys.setclientinfo(property string, value string) + to allow the client application to set a specific client info property. +- Added system table sys.clientinfo_properties that lists the supported + client info properties and their associated column name in sys.sessions view. + It contains property names: ClientHostname, ApplicationName, + ClientLibrary, ClientPid and ClientRemark. + * Mon May 13 2024 Niels Nes <ni...@cwi.nl> - Extended sys.generate_series() to generate dates. Added 2 new functions: sys.generate_series(first date, "limit" date, stepsize interval month) and 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 @@ -7101,13 +7101,14 @@ sql_update_aug2024(Client c, mvc *sql, s "create procedure sys.setclientinfo(property string, value string)\n" " external name clients.setinfo;\n" "grant execute on procedure sys.setclientinfo(string, string) to public;\n" - "create table sys.clientinfo_properties(prop string, session_attr string);\n" + "create table sys.clientinfo_properties(prop varchar(40) NOT NULL, session_attr varchar(40) NOT NULL);\n" "insert into sys.clientinfo_properties values\n" " ('ClientHostname', 'hostname'),\n" " ('ApplicationName', 'application'),\n" " ('ClientLibrary', 'client'),\n" - " ('ClientRemark', 'remark'),\n" - " ('ClientPid', 'clientpid');\n" + " ('ClientPid', 'clientpid'),\n" + " ('ClientRemark', 'remark');\n" + "grant select on sys.clientinfo_properties to public;\n" "update sys.functions set system = true where schema_id = 2000 and name in ('setclientinfo', 'sessions');\n" "update sys._tables set system = true where schema_id = 2000 and name in ('clientinfo_properties', 'sessions');\n"; @@ -7116,7 +7117,12 @@ sql_update_aug2024(Client c, mvc *sql, s printf("Running database upgrade commands:\n%s\n", query3); fflush(stdout); err = SQLstatementIntern(c, query3, "update", true, false, NULL); - + if (err == MAL_SUCCEED) { + const char query3b[] = "alter table sys.clientinfo_properties SET READ ONLY;\n"; + printf("Running database upgrade commands:\n%s\n", query3b); + fflush(stdout); + err = SQLstatementIntern(c, query3b, "update", true, false, NULL); + } if (err == MAL_SUCCEED) { const char query4[] = "DROP TABLE sys.key_types;\n" @@ -7129,7 +7135,6 @@ sql_update_aug2024(Client c, mvc *sql, s "(2, 'Foreign Key'),\n" "(3, 'Unique Key With Nulls Not Distinct'),\n" "(4, 'Check Constraint');\n" - "GRANT SELECT ON sys.key_types TO PUBLIC;\n" "UPDATE sys._tables SET system = true WHERE schema_id = 2000 AND name = 'key_types';\n"; if ((t = mvc_bind_table(sql, s, "key_types")) != NULL) diff --git a/sql/scripts/22_clients.sql b/sql/scripts/22_clients.sql --- a/sql/scripts/22_clients.sql +++ b/sql/scripts/22_clients.sql @@ -44,13 +44,16 @@ create view sys.sessions as select * fro create procedure sys.setclientinfo(property string, value string) external name clients.setinfo; grant execute on procedure sys.setclientinfo(string, string) to public; -create table sys.clientinfo_properties(prop string, session_attr string); + +create table sys.clientinfo_properties(prop varchar(40) NOT NULL, session_attr varchar(40) NOT NULL); insert into sys.clientinfo_properties values ('ClientHostname', 'hostname'), ('ApplicationName', 'application'), ('ClientLibrary', 'client'), - ('ClientRemark', 'remark'), - ('ClientPid', 'clientpid'); + ('ClientPid', 'clientpid'), + ('ClientRemark', 'remark'); +alter table sys.clientinfo_properties SET READ ONLY; +grant select on sys.clientinfo_properties to public; -- routines to bring the system down quickly create procedure sys.shutdown(delay tinyint) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org