Bah!
More bad news for me. When I attempt to delete the group from the Groups Admin page (Nuke this group), I get the same foreign key violation on my group.
[04/Sep/2003:15:32:53][5032.19476][-conn:openacs-dev::16] Notice: Querying 'select __exec_43_delete_group ();'
NOTICE: BEGIN Deleting relation composition_rel, id 7420
NOTICE: identifier "rel_constraint__violation_if_removed" will be truncated to "rel_constraint__violation_if_re"
NOTICE: END Deleting relation composition_rel(7420)
NOTICE: BEGIN Deleting segment 7422
NOTICE: END Deleting segment 7422
NOTICE: BEGIN Deleting segment 7425
NOTICE: END Deleting segment 7425
NOTICE: BEGIN Deleting group 7417
NOTICE: END Deleting group 7417
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Error: Ns_PgExec: result status: 7 message: ERROR: acs_permissions_grantee_id_fk referential integrity violation - key in parties still referenced from acs_permissions
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Error: dbinit: error(localhost::openacs-dev,ERROR: acs_permissions_grantee_id_fk referential integrity violation - key in parties still referenced from acs_permissions
): 'select __exec_43_delete_group ()'
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Notice: Querying 'drop function __exec_43_delete_group ();'
NOTICE: current transaction is aborted, queries ignored until end of transaction block
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Notice: dbinit: sql(localhost::openacs-dev): 'drop function __exec_43_delete_group ()'
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Notice: Querying 'abort transaction;'
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Notice: Ns_PgExec: Rolling back transaction
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Notice: dbinit: sql(localhost::openacs-dev): 'abort transaction'
[04/Sep/2003:15:32:55][5032.19476][-conn:openacs-dev::16] Notice: RP (3266.875 ms): error in rp_handler: serving GET /admin/groups/delete-2?group_id=7417&operation=Yes%2C+I+really+want+to+delete+this+group
ad_url "/admin/groups/delete-2" maps to file "/www/nsroot/openacs-dev/packages/acs-subsite/www/admin/groups/delete-2.tcl"
errmsg is Transaction aborted: Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
Makes sense since ultimately it ends up calling acs_group__delete just like I tried in psql!
So if I do this first
delete from acs_permissions where grantee_id in (select segment_id from rel_segments where group_id = 7417);
delete from acs_permissions where grantee_id = 7417;
then my call to acs_group__delete(7417);
works fine. I think something to this effect should be added to acs_group__delete
pl/sql function so that the group delete just works.