@generic.invalidate_table_constraints
    def rename_table(self, old_table_name, table_name):
        # First, rename the table
        generic.DatabaseOperations.rename_table(self, old_table_name, table_name)
        # Then, try renaming the ID sequence
        # (if you're using other AutoFields... your problem, unfortunately)

        if self.execute(
            """
            SELECT 1
            FROM information_schema.sequences
            WHERE sequence_name = %s
            """,
            [old_table_name + '_id_seq']
        ):
            generic.DatabaseOperations.rename_table(self, old_table_name + "_id_seq", table_name + "_id_seq")

        # Rename primary key index, will not rename other indices on
        # the table that are used by django (e.g. foreign keys). Until
        # figure out how, you need to do this yourself.

        pkey_index_names = self.execute(
            """
            SELECT pg_index.indexrelid::regclass
            FROM pg_index, pg_attribute
            WHERE
              indrelid = %s::regclass AND
              pg_attribute.attrelid = indrelid AND
              pg_attribute.attnum = any(pg_index.indkey)
              AND indisprimary
            """,
            [table_name]
        )
        if old_table_name + "_pkey" in pkey_index_names:
            generic.DatabaseOperations.rename_table(self, old_table_name + "_pkey", table_name + "_pkey")
will rename the table and an associated ID sequence and primary key index
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/South-1.0.2/south/db/postgresql_psycopg2.py/DatabaseOperations.rename_table