class PgConn::RoleMethods

def drop(*rolenames, cascade: false, fail: true, silent: false)

TODO The :silent option is used in tests - fix it somehow!

privileges exist.
Note that cascade only works if connected to the database where the

counldn't be deleted
user(s) was deleted and false if :fail is true and one or more user
privileges and objects too if :cascade is true. Returns true if the
Drop existing users. Return true if any role was dropped. Drop depending
def drop(*rolenames, cascade: false, fail: true, silent: false)
  rolenames = Array(rolenames).flatten.compact.select { |role| exist?(role) }
  return false if rolenames.empty?
  rolenames_sql = PgConn.sql_idents(rolenames)
  begin
  conn.exec("drop owned by #{rolenames_sql} cascade", fail: false, silent: silent) if cascade
  conn.exec("drop role #{rolenames_sql}", fail: fail, silent: silent) && true
  rescue PG::Error
    raise if fail
    conn.cancel_transaction
    return false
  end
end