[med-svn] [Git][med-team/gnumed-server][upstream] New upstream version 22.31

Andreas Tille (@tille) gitlab at salsa.debian.org
Sun Apr 27 18:20:50 BST 2025



Andreas Tille pushed to branch upstream at Debian Med / gnumed-server


Commits:
6822b070 by Andreas Tille at 2025-04-27T19:12:00+02:00
New upstream version 22.31
- - - - -


3 changed files:

- server/doc/schema/gnumed-entire_schema.html
- server/pycommon/gmPG2.py
- server/sql/v21-v22/fixups/v22-release_notes-fixup.sql


Changes:

=====================================
server/doc/schema/gnumed-entire_schema.html
=====================================
@@ -112,7 +112,7 @@
 <body>
 
 <!-- Primary Index -->
-<p><br><br>Dumped on 2025-03-30</p>
+<p><br><br>Dumped on 2025-04-20</p>
 <h1><a name="index">Index of database - gnumed_v22</a></h1>
 <ul>
   
@@ -127481,58 +127481,65 @@ END;</pre>
 DECLARE
 	_identity_row record;
 	_names_row record;
+	_names_pks integer[];
 	_other_identities integer[];
 BEGIN
 	-- working on dem.identity
 	if TG_TABLE_NAME = 'identity' then
 		_identity_row := NEW;
-		select * into _names_row from dem.names where id_identity = NEW.pk;
+		select array_agg(id) into _names_pks from dem.names where id_identity = NEW.pk;
 	-- working on dem.names
 	else
 		select * into _identity_row from dem.identity where pk = NEW.id_identity;
-		_names_row := NEW;
+		select ARRAY[NEW.id] into _names_pks;
 	end if;
-	-- there cannot be any combination of identical
-	-- (dob, firstname, lastname, identity.comment)
-	-- so, look for clashing rows
-	SELECT array_agg(pk_identity) INTO _other_identities FROM
-		dem.v_person_names d_vpn
-			join dem.identity d_i on (d_i.pk = d_vpn.pk_identity)
-	WHERE
-		-- same firstname
-		d_vpn.firstnames = _names_row.firstnames
-			AND
-		-- same lastname
-		d_vpn.lastnames = _names_row.lastnames
-			AND
-		-- same gender
-		d_i.gender is not distinct from _identity_row.gender
-			AND
-		-- same dob (day)
-		date_trunc('day', d_i.dob) is not distinct from date_trunc('day', _identity_row.dob)
-			AND
-		-- same discriminator
-		d_i.comment is not distinct from _identity_row.comment
-			AND
-		-- but not the currently updated or inserted row
-		d_i.pk != _identity_row.pk
-	;
-	if coalesce(array_length(_other_identities, 1), 0) > 0 then
-		RAISE EXCEPTION
-			'[dem.assert_unique_named_identity] % on %.%: More than one person with (firstnames=%), (lastnames=%), (dob=%), (comment=%): % & %',
-				TG_OP,
-				TG_TABLE_SCHEMA,
-				TG_TABLE_NAME,
-				_names_row.firstnames,
-				_names_row.lastnames,
-				_identity_row.dob,
-				_identity_row.comment,
-				_identity_row.pk,
-				_other_identities
-			USING ERRCODE = 'unique_violation'
+	-- loop over names rows belonging to identity
+	FOR _names_row IN
+		SELECT * FROM dem.names
+		WHERE id = ANY(_names_pks)
+	LOOP
+		-- there must not be any combination of identical
+		-- (dob, firstname, lastname, identity.comment)
+		-- so, look for clashing rows
+		SELECT array_agg(pk_identity) INTO _other_identities FROM
+			dem.v_person_names d_vpn
+				join dem.identity d_i on (d_i.pk = d_vpn.pk_identity)
+		WHERE
+			-- same firstname
+			d_vpn.firstnames = _names_row.firstnames
+				AND
+			-- same lastname
+			d_vpn.lastnames = _names_row.lastnames
+				AND
+			-- same gender
+			d_i.gender is not distinct from _identity_row.gender
+				AND
+			-- same dob (day)
+			date_trunc('day', d_i.dob) is not distinct from date_trunc('day', _identity_row.dob)
+				AND
+			-- same discriminator
+			d_i.comment is not distinct from _identity_row.comment
+				AND
+			-- but not the currently updated or inserted row
+			d_i.pk != _identity_row.pk
 		;
-		RETURN NULL;
-	end if;
+		if coalesce(array_length(_other_identities, 1), 0) > 0 then
+			RAISE EXCEPTION
+				'[dem.assert_unique_named_identity] % on %.%: More than one person with (firstnames=%), (lastnames=%), (dob=%), (comment=%): % & %',
+					TG_OP,
+					TG_TABLE_SCHEMA,
+					TG_TABLE_NAME,
+					_names_row.firstnames,
+					_names_row.lastnames,
+					_identity_row.dob,
+					_identity_row.comment,
+					_identity_row.pk,
+					_other_identities
+				USING ERRCODE = 'unique_violation'
+			;
+			RETURN NULL;
+		end if;
+	END LOOP;
 	return NEW;
 END;</pre>
 


=====================================
server/pycommon/gmPG2.py
=====================================
@@ -699,7 +699,10 @@ def get_db_fingerprint(conn=None, fname=None, with_dump=False, eol=None):
 		try:
 			curs.execute(cmd)
 			rows = curs.fetchall()
-			val = rows[0][0]
+			if rows:
+				val = rows[0][0]
+			else:
+				val = '<not found>'
 		except PG_ERROR_EXCEPTION as pg_exc:
 			if pg_exc.pgcode != sql_error_codes.INSUFFICIENT_PRIVILEGE:
 				raise
@@ -2887,10 +2890,10 @@ SELECT to_timestamp (foofoo,'YYMMDD.HH24MI') FROM (
 	#test_row_locks()
 	#test_faulty_SQL()
 	#test_log_settings()
-	#test_get_db_fingerprint()
+	test_get_db_fingerprint()
 	#test_schema_compatible()
 	#test_get_schema_structure()
-	test___get_schema_structure()
+	#test___get_schema_structure()
 	#test_pg_temp_concat()
 
 # ======================================================================


=====================================
server/sql/v21-v22/fixups/v22-release_notes-fixup.sql
=====================================
@@ -17,14 +17,22 @@ INSERT INTO dem.message_inbox (
 ) VALUES (
 	(select pk from dem.staff where db_user = 'any-doc'),
 	(select pk_type from dem.v_inbox_item_type where type = 'memo' and category = 'administrative'),
-	'Release Notes for GNUmed 1.8.20 (database v22.30)',
-	'GNUmed 1.8.20 Release Notes:
+	'Release Notes for GNUmed 1.8.21 (database v22.31)',
+	'GNUmed 1.8.21 Release Notes:
+
+	1.8.21
+
+FIX: startup: crash on fingerprinting v15+ servers [thanks gm-dbo]
 
 	1.8.20
 
 FIX: startup: crash on fingerprinting episodes in DB if gm-staff [thanks Maria]
 FIX: patient search: gm-staff shall not ensure patient-ness [thanks Maria]
 
+	22.31
+
+FIX: crash on fingerprinting v15+ servers [thanks gm-dbo]
+
 	22.30
 
 FIX: unique constraint on identity+name with multiple names per identity [thanks Maria]
@@ -34,4 +42,4 @@ FIX: permissions on org/unit tables/views
 ');
 
 -- --------------------------------------------------------------
-select gm.log_script_insertion('v22-release_notes-fixup.sql', '22.30 at 1.8.20');
+select gm.log_script_insertion('v22-release_notes-fixup.sql', '22.31 at 1.8.21');



View it on GitLab: https://salsa.debian.org/med-team/gnumed-server/-/commit/6822b0700d44f5d766802fba4ab4ffd426d6ead9

-- 
View it on GitLab: https://salsa.debian.org/med-team/gnumed-server/-/commit/6822b0700d44f5d766802fba4ab4ffd426d6ead9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20250427/5dcc86c0/attachment-0001.htm>


More information about the debian-med-commit mailing list