fix the bad rqlst syntax tree usage during facets initialization by copying it
/* -*- sql -*- postgres specific registered procedures for the Bytes File System storage, require the plpythonu language installed*/CREATEORREPLACEFUNCTION_fsopen(bytea)RETURNSbyteaAS$$fpath=args[0]iffpath:try:data=file(fpath,'rb').read()#/* XXX due to plpython bug we have to replace some characters... */returndata.replace("\\",r"\134").replace("\000",r"\000").replace("'",r"\047")#' except Exception, ex: plpy.warning('failedtogetcontentfor%s:%s', fpath, ex) return None$$ LANGUAGE plpythonu/* WITH(ISCACHABLE) XXX does postgres handle caching of large data nicely */;;/* fspath(eid, entity type, attribute) */CREATE OR REPLACE FUNCTION fspath(bigint, text, text) RETURNS bytea AS $$ pkey = 'plan%s%s' % (args[1], args[2]) try: plan = SD[pkey] except KeyError: #/* then prepare and cache plan to get versioned file information from a # version content eid */ plan = plpy.prepare( 'SELECTX.cw_%sFROMcw_%sasXWHEREX.cw_eid=$1' % (args[2], args[1]), ['bigint'])SD[pkey]=planreturnplpy.execute(plan,[args[0]])[0]$$LANGUAGEplpythonu/* WITH(ISCACHABLE) XXX does postgres handle caching of large data nicely */;;