* Avoid using create_idx from a PGresult that's already been PQclear'ed
* Now that we're properly tracking which indexes have been repacked,
don't bother with IF EXISTS in DROP INDEX. Better to make any errors
here stand out.
* Fix error handling in repack_table_indexes() to keep track of which
indexes were actually rebuilt successfully by pg_repack, so that only
those indexes will be dropped. Previously, we would issue an error
message telling the user to use DROP INDEX but then just drop the
index anyway.
* DROP INDEX command needs to quote the schema name in case it is
not simple.
* missing CLEARPGRES() in repack_all_indexes()
Improve locking behavior in indexes-only mode so we only need one
ACCESS EXCLUSIVE lock per table instead of one per index. Support
multiple --index options. Fix for schema-name parsing.
Patch from Beena Emerson.
Switch to using the two-input form of pg_advisory_lock(), so as
to avoid impacting other applications which might happen to lock
just the OID of the table. The REPACK_LOCK_PREFIX_STR is a decimal
version of the first three bytes of
echo -n "pg_repack" | sha1sum
Since we are not starting a new transaction in conn2 during the
swap step, we need to make sure that if our LOCK query is canceled
due to statement_timeout that conn2's transaction is not left in
a useless error state. Use SAVEPOINT and ROLLBACK TO SAVEPOINT to
avoid this problem.
Per Issue #7 from armanddp, it seems the RHEL/CentOS packages
of Postgres are built against libpam, which shows up in
the LIBS reported by pg_config. We don't actually need to
link in libpam for pg_repack, so manually remove it from
our LIBS. This helps a little bit for building on
RHEL/CentOS, though the issue of libpgport.a missing
on that platform still looms.
Makes injecting the target tablespace much easier and fixes interaction
between tablespace and WITH/WHERE clauses.
Added tests to check the correct indexes definition.
Not as available as I thought.
Can't use the 0 prefix to make the 3rd number optional as $(()) parses is as
octal, so only use the first 2 numbers.
Also fixed collate test: not available on PG 9.0.
--no-order now is almost useless, but list it next to --order-by.
--jobs only specifies how to do something, not what to do. On the
same basis probably --no-analyze should be pushed further up.
In the previous commit skip_const was going ahead the space thus removing the
starting quote. Also fixed (and tested) trailing part after the tablespace
name, e.g. the WHERE clause.
Note: if original namespace is "foo bar", repack_indexdef gives a bad
result. This is weird as apparently skip_ident can deal with spaces in
a quoted identifier. Committing as I'm going home, will deal with that
later.
Bumped version number to enforce extension re-creation as the SQL has
been modified.
Current limitations:
- Check for namespace existence: on error temp objects are left around
- What happens to the indexes?
- Tests needed.
- Should the default be the GUC default_tablespace instead of pg_default?
This is actually an original pg_repack shortcoming, not a regression.