+ # The reason we try and check to see if it exists is that
+ # psycopg2 might leave the cursor invalid if the drop fails
+ c.execute("SELECT proname from pg_catalog.pg_proc WHERE proname = 'versioncmp'")
+ rows = c.fetchall()
+ if rows:
+ c.execute("DROP FUNCTION versioncmp(text, text);")
+ else:
+ print "function already does not exist"
+