Project

General

Profile

« Previous | Next » 

Revision 5445

sql.py: Added index_cond()

View differences:

lib/sql.py
1123 1123
    else: raise NotImplementedError("Can't list index columns for "+module+
1124 1124
        ' database')
1125 1125

  
1126
def index_cond(db, index):
1127
    index = sql_gen.as_Table(index)
1128
    module = util.root_module(db.db)
1129
    if module == 'psycopg2':
1130
        qual_index = sql_gen.Literal(index.to_str(db))
1131
        return value(run_query(db, '''\
1132
SELECT pg_get_expr(indpred, indrelid, true)
1133
FROM pg_index
1134
WHERE indexrelid = '''+qual_index.to_str(db)+'''::regclass
1135
'''
1136
            , cacheable=True, log_level=4))
1137
    else: raise NotImplementedError()
1138

  
1126 1139
#### Functions
1127 1140

  
1128 1141
def function_exists(db, function):

Also available in: Unified diff