#NEWLINE# def as_postgresql( self , compiler , connection ) : #NEWLINE# #INDENT# ( lhs , lhs_params ) = self . process_lhs ( compiler , connection ) #NEWLINE# ( rhs , rhs_params ) = self . process_rhs ( compiler , connection ) #NEWLINE# if ( ( len ( rhs_params ) == 1 ) and isinstance ( rhs_params [ 0 ] , dict ) ) : #NEWLINE# #INDENT# param = rhs_params [ 0 ] #NEWLINE# sign = ( ( ( ( self . lookup_name [ 0 ] == 'g' ) and '>%s' ) or '<%s' ) % ( ( ( self . lookup_name [ ( - 1 ) ] == 'e' ) and '=' ) or '' ) ) #NEWLINE# param_keys = list ( param . keys ( ) ) #NEWLINE# conditions = [ ] #NEWLINE# for key in param_keys : #NEWLINE# #INDENT# cast = get_cast_for_param ( self . value_annot , key ) #NEWLINE# conditions . append ( ( "(%s->'%s')%s %s %%s" % ( lhs , key , cast , sign ) ) ) #NEWLINE# #UNINDENT# return ( ' AND ' . join ( conditions ) , param . values ( ) ) #NEWLINE# #UNINDENT# raise ValueError ( 'invalid value' )