Package: postgresql-common Version: 73 Severity: normal I'm using the postgresql packages in an environment having 20,000+ groups, queried over LDAP on a remote server. In this situation, the change_uid function in PgCommon.pm is unbearably slow. To wit:
[EMAIL PROTECTED]:~$ time sudo perl -I /usr/share/postgresql-common/ -MPgCommon -e 'change_ugid(29,29)' real 36m7.986s user 0m39.722s sys 0m18.360s The following implementation seems to work equivalently, and is orders of magnitude faster. ------------------------------------------------------------------ sub change_uid { my ($uid, $gid) = @_; my $groups = $gid; $groups .= " $groups"; # first additional group # collect all auxiliary groups the user is in my ($uname, undef) = getpwuid($uid); $groups .= " " . `id -G $uname`; $) = $groups; $( = $gid; $> = $< = $uid; error 'Could not change user id' if $< != $uid; error 'Could not change group id' if $( != $gid; } ------------------------------------------------------------------ Please consider integrating it. The id command is in coreutils, so I assume there are no dependency problems involved. Alternatively, if for some reason this would not work (my unix-fu is not that high) you should consider cacheing the results of the getpw* calls. Thanks. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]