Skip to content

'NoneType' object is not subscriptable in rebuild_index function after manual index reindexing #35

@Andrey3096

Description

@Andrey3096

Description

The script encounters a TypeError in the rebuild_index function when processing index rebuilding operations.

How to reproduce

  1. Run the bloat analysis script on a PostgreSQL database. I ran with this command
    ./pg_bloat_check.py -c "host=<host> dbname=<db> user=<db_owner>" --bloat_schema=monitoring --format=jsonpretty --min_size='50mb' -N pg_toast --recovery_mode_norun --rebuild_index --debug > report.txt
  2. Identify indexes that require rebuilding
  3. Manually execute REINDEX INDEX CONCURRENTLY on one or more indexes
    reindex index concurrently idx_large_table_composite; REINDEX
  4. Continue with the script's index rebuilding process
    ./pg_bloat_check.py -c "host=<host> dbname=<db> user=<db_owner>" --bloat_schema=monitoring --format=jsonpretty --min_size='50mb' -N pg_toast --recovery_mode_norun --rebuild_index --debug > report.txt
  5. Script fails with TypeError
    `Traceback (most recent call last):
    File "/Users/andrey.samsonov/utils/pg_bloat_check/./pg_bloat_check.py", line 747, in
    rebuild_index(conn, result)

File "/Users/andrey.samsonov/utils/pg_bloat_check/./pg_bloat_check.py", line 513, in rebuild_index
quoted_table = """ + result[0] + ""."" + result[1] + """
~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable`

Unfortunately, i didn't come up with a solution but hope for your attention to this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions