Changeset 705


Ignore:
Timestamp:
Jan 9, 2016, 3:49:18 PM (4 years ago)
Author:
cito
Message:

Use more idiomatic SQL for boolean attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/pg.py

    r704 r705  
    591591                    " AND pg_namespace.nspname NOT LIKE 'pg_%'"
    592592                " JOIN pg_attribute ON pg_attribute.attrelid = pg_class.oid"
    593                     " AND pg_attribute.attisdropped = 'f'"
     593                    " AND NOT pg_attribute.attisdropped"
    594594                " JOIN pg_index ON pg_index.indrelid = pg_class.oid"
    595                     " AND pg_index.indisprimary = 't'"
     595                    " AND pg_index.indisprimary"
    596596                    " AND pg_attribute.attnum"
    597597                        " = ANY (pg_index.indkey)").getresult():
     
    667667            " WHERE pg_namespace.nspname = '%s' AND pg_class.relname = '%s'"
    668668            " AND (pg_attribute.attnum > 0 OR pg_attribute.attname = 'oid')"
    669             " AND pg_attribute.attisdropped = 'f'") % cl
     669            " AND NOT pg_attribute.attisdropped") % cl
    670670        q = self.db.query(q).getresult()
    671671
Note: See TracChangeset for help on using the changeset viewer.