Alon Bar-Lev has uploaded a new change for review. Change subject: db: execute privileged upgrade operation only if required ......................................................................
db: execute privileged upgrade operation only if required Having a privileged user during installation should be avoided. But in this case it is required due to legacy, so avoid if we can. Change-Id: I66da7066b26e9aa18df75e4a36e520c495a5880f Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M backend/manager/dbscripts/dbfunctions.sh 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/49/12949/1 diff --git a/backend/manager/dbscripts/dbfunctions.sh b/backend/manager/dbscripts/dbfunctions.sh index d4b4460..a0e862f 100755 --- a/backend/manager/dbscripts/dbfunctions.sh +++ b/backend/manager/dbscripts/dbfunctions.sh @@ -86,8 +86,17 @@ execute_command "$CMD" ${DATABASE} ${SERVERNAME} ${PORT} > drop_all_functions.sql execute_file "drop_all_functions.sql" ${DATABASE} ${SERVERNAME} ${PORT} > /dev/null \rm -f drop_all_functions.sql - #drop old uuid functions - psql -U postgres -h ${SERVERNAME} -p ${PORT} -f drop_old_uuid_functions.sql ${DATABASE} > /dev/null + + # + # dropping the uuid extension and old functions is + # required only if we upgrade from old database + # as it requires special privileges, so + # before execution check if actually required + # + CMD="select count(*) from pg_proc where proname = lower('uuid_nil');" + if [ "$(execute_command "$CMD" ${DATABASE} ${SERVERNAME} ${PORT} | sed -e 's/ //g' -e '/^$/d')" != 0 ]; then + psql -U postgres -h ${SERVERNAME} -p ${PORT} -f drop_old_uuid_functions.sql ${DATABASE} > /dev/null + fi # recreate generic functions execute_file "create_functions.sql" ${DATABASE} ${SERVERNAME} ${PORT} > /dev/null } -- To view, visit http://gerrit.ovirt.org/12949 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66da7066b26e9aa18df75e4a36e520c495a5880f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches