Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 30th, 2012  |  syntax: None  |  size: 0.30 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. A PostgreSQL trigger that moves a file on the filesystem
  2. CREATE OR REPLACE FUNCTION  move_file(old_path text, new_path text)
  3. RETURNS boolean AS
  4. $$
  5.     import shutil
  6.     try:
  7.        shutil.move(old_path, new_path)
  8.        return True
  9.     except:
  10.        return False
  11. $$
  12.   LANGUAGE 'plpythonu' VOLATILE;