37 Commits

Author SHA1 Message Date
Masahiko Sawada
64cc2070ed Fix the broken behavior made by restricting the search path
This commit doesn't include the change of regression test files.
2018-04-06 14:50:40 +09:00
Daniele Varrazzo
07e944d9d1 Use the Postgres way to get the version number
Unsurprisingly, there was one.
2018-03-19 19:07:33 +00:00
Daniele Varrazzo
2fd0eb050a A more compact way to verify the identity of the test files 2018-03-09 15:32:26 +00:00
Dmitry Ivanov
e1f362e831 resolve conflicts 2017-04-19 14:05:53 +03:00
Masahiko Sawada
a6b2b0e82e Fix a mistake of merging.
Also fix regression test failure.
2017-04-11 23:43:21 +09:00
Masahiko Sawada
d55a08fc1e Merge branch 'master' into toast_storage_param 2017-04-11 23:30:27 +09:00
Masahiko Sawada
b6ea2ca3c9 Fix the mix of tabs and space. 2017-04-10 23:26:58 +01:00
Masahiko Sawada
5adff6ff0b Set column storage type before first copying table.
Previously, even if the table whose column storage type has been
changed the pg_repack did first copy the data to table without changing
column storage paramater. This cause of that the existing data is
pushed out to its toast table even if actual column storage type is
"main".

Issue #94.
2017-04-10 23:25:49 +01:00
Masahiko Sawada
ca5ca11d4d Specify the storage option for TOAST table when create table.
The storage option such as AUTOVACUUM_VACUUM_SCALE_FACTOR can be
set to both heap table and TOAST table. But the storage parameter
for TOAST table had gone after repacked. This change create new
function get_storage_param which returns all storage paramters
including for TOAST table and OID setting.

Issue #10.
2017-04-10 23:20:50 +01:00
Dmitry Ivanov
839aec7e71 remove blank line 2017-03-24 16:56:27 +03:00
Dmitry Ivanov
68dc592545 introduce option --parent-table (-I, stands for 'inheritance'), fix function repack_one_database(), introduce function repack.get_table_and_inheritors() 2017-03-20 23:05:26 +03:00
Masahiko Sawada
375f03c0c3 Change trigger name from a_repack_trigger to repack_trigger.
In AFTER trigger context, since triggered tuple is not changed by
any other triggers we can call it just repack_trigger.
2017-01-24 14:09:05 +09:00
Masahiko Sawada
d83ee3d6a0 Change trigger type to AFTER trigger.
During repacking table, if a transaction executes INSERT CONFLICT
ON UPDATE/DO NOTHING, because we define BEFORE trigger on target
table, the contents of operation log table becomes inconsistent
easliy. As a result, pg_reapck fails with a high probability.

To resolve this issue, this changes the trigger type from BEFORE
to AFTER. We define AFTER trigger that is the first of the AFTER
trigger to fire on the table.
2017-01-19 16:32:54 +09:00
Daniel Cheng (鄭郁邦)
71f8833958 Do not repack unlogged tables (close #71) 2016-02-12 18:50:45 +08:00
kotsachin
ad109edb5b This patch contains repack_cleanup_callback() which calls to repack_drop() for cleaning temporary objects. repack_cleanup_callback() will be pushed on stack using pgut_atexit_push() at beginning so that it will pop on abort or exit of program.
This patch includes one global counter (temp_obj_num) which counts number of temporary objects created by pg_repack. Correct order of deletion of temporary object as per count avoids unintentional error messages.
2015-04-17 13:07:01 +09:00
Daniele Varrazzo
a49bb41822 Dropped use of reltoastidxid field
The same index can be reached going through reltoastrelid and
pg_index.indrelid: checked at least on PG 9.1.
2015-03-10 14:53:49 +00:00
Josh Kupershmidt
080ebd3ed6 Bump up Copyright notices for 2015 2015-01-11 19:01:37 -05:00
Josh Kupershmidt
e2c720b89c Perform sql_pop delete in bulk instead of one-at-a-time.
Prior to 506104686b these DELETEs had been done in large batches (of
DEFAULT_PEEK_COUNT size), but that naive method of choosing rows to
delete was unsafe. Here we continue to keep track of which rows must
be deleted as we process them.
2014-05-25 22:04:13 -04:00
Josh Kupershmidt
f0cd787bf5 Merge in Pull Request #20 from Steeve Lennmark.
Adds support for repacking only the tables in a specified schema. This
doesn't support --only-indexes mode, but that seems alright for now.

Fix merge conflicts, and make a few tweaks along the way:
 * bump version to 1.3-dev0
 * add Beena to list of maintainers
 * documentation wordsmithing
 * fix up the INFO message printed for each index in --index or
   --only-indexes mode, so that it is only printed once per index, and
   prints the name of the original index, not that of the transient
   index_%u name.
2014-05-24 15:42:24 -04:00
Josh Kupershmidt
506104686b Fix a nasty data loss/corruption bug from the sql_pop query.
It is not safe to assume that we can bulk-delete all entries from the
log table based on their "id" being less than the largest "id" we have
processed so far, as we may unintentionally delete some tuples from the
log which we haven't actually processed yet in the case of concurrent
transactions adding tuples into the log table.
2014-04-22 10:56:24 -04:00
Steeve Lennmark
e16472419f Fix regression while refactoring patch 2014-01-22 14:55:07 +01:00
Josh Kupershmidt
ee23ec8ffd Initial import of indexes-only building patch.
Patch from Beena Emerson.
2013-06-21 18:41:09 -04:00
Daniele Varrazzo
477fba884c Ignore AFTER triggers sorting after z_repack_trigger
They are not a problem, and they fore after the BEFORE trigger anyway.

To be checked against more PostgreSQL versions.
2013-04-18 01:19:52 +01:00
Daniele Varrazzo
22762fce28 Fixed query for PG 8.3
The AS keyword was required.
2013-04-17 22:08:37 +01:00
Daniele Varrazzo
42c65d16f8 Merge branch 'change-tablespace'
Conflicts:
	bin/pg_repack.c
	doc/pg_repack.rst
2013-04-17 09:07:09 +01:00
Daniele Varrazzo
1d62d8d0c5 More helpful error messages in case of conflicting triggers
Closes issue #5.
2013-04-17 00:57:01 +01:00
Daniele Varrazzo
83fdb2a9e0 Added implementation for --moveidx
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.
2013-04-16 22:42:23 +01:00
Daniele Varrazzo
a6e50515ce Merge branch 'master' into change-tablespace 2013-04-16 22:40:43 +01:00
Daniele Varrazzo
6710e514db Added --namespace option to set the namespace of repacked tables
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.
2013-02-21 17:20:54 +00:00
Daniele Varrazzo
4bcb7641c9 Function get_index_keys() renamed to get_order_by()
It was a FIXME item in the source. Reasonably so.
2012-12-09 11:35:52 +00:00
Daniele Varrazzo
deaae7dd72 Added version_sql() function and consistency check of sql version 2012-11-16 21:32:28 +00:00
Daniele Varrazzo
44bf1543be Don't choose a partial index as primary key
Fixes reorg/pg_reorg#22
2012-11-15 00:16:38 +00:00
Daniele Varrazzo
673a8ea100 The repack schema is contained in the pg_repack extension
...not the other way around. This allows DROP EXTENSION ... CASCADE to
remove temporary directories, simplifying the cleanup procedure after an
error, and getting rid of the schema on uninstall.
2012-11-13 14:02:45 +00:00
Daniele Varrazzo
6f8a8bab6d support for ENABLE TRIGGER renamed to enable_trigger from alter_table 2012-11-12 11:51:20 +00:00
Daniele Varrazzo
1d60a946ff Added The Reorg Development Team copyright 2012-11-11 03:00:00 +00:00
Daniele Varrazzo
db1c554f60 Dropped executable flags 2012-11-11 02:48:46 +00:00
Daniele Varrazzo
b7799c1782 Fork the pg_repack extension 2012-11-10 22:33:57 +00:00