schemas/_regproc_bss.postgres.sql
changeset 4328 b8112afb213c
parent 4322 f65743cc53e4
child 4941 ec27aea9632b
equal deleted inserted replaced
4327:e397b921c40f 4328:b8112afb213c
     8 
     8 
     9 CREATE OR REPLACE FUNCTION _fsopen(bytea) RETURNS bytea AS $$
     9 CREATE OR REPLACE FUNCTION _fsopen(bytea) RETURNS bytea AS $$
    10     fpath = args[0]
    10     fpath = args[0]
    11     if fpath:
    11     if fpath:
    12         try:
    12         try:
    13 	    data = file(fpath, 'rb').read()
    13             data = file(fpath, 'rb').read()
    14 	    #/* XXX due to plpython bug we have to replace some characters... */
    14             #/* XXX due to plpython bug we have to replace some characters... */
    15             return data.replace("\\", r"\134").replace("\000", r"\000").replace("'", r"\047") #'
    15             return data.replace("\\", r"\134").replace("\000", r"\000").replace("'", r"\047") #'
    16         except Exception, ex:
    16         except Exception, ex:
    17 	    plpy.warning('failed to get content for %s: %s', fpath, ex)
    17             plpy.warning('failed to get content for %s: %s', fpath, ex)
    18      return None
    18     return None
    19 $$ LANGUAGE plpythonu
    19 $$ LANGUAGE plpythonu
    20 /* WITH(ISCACHABLE) XXX does postgres handle caching of large data nicely */
    20 /* WITH(ISCACHABLE) XXX does postgres handle caching of large data nicely */
    21 ;;
    21 ;;
    22 
    22 
    23 /* fspath(eid, entity type, attribute) */
    23 /* fspath(eid, entity type, attribute) */