139 Commits

Author SHA1 Message Date
Masahiko Sakamoto
e9d4ef2557 Supports CREATE EXTENSION.
I've changed lib/Makefile to support CREATE EXTENSION.
In order to work with previeous PostgreSQL version (i.e. < 9.1),
this implementation installs both pg_reorg--1.0.sql and pg_reorg.sql.

This patch lacks regression testcases for CREATE EXTENSION, which I will commit soon.
2012-11-10 19:51:30 +00:00
Josh Kupershmidt
d603c49b40 Get rid of unused getint16() function to quiet compiler.
Also, small whitespace fixup.
2012-11-06 20:30:49 -07:00
Josh Kupershmidt
05111376c8 Remove TODO comment about ASC/DESC and NULLS FIRST/LAST index options.
As far as I can tell, the code already supports these index options, so
put in a small installcheck test exercising these index options and call
it good.
2012-10-21 16:54:33 -07:00
Josh Kupershmidt
0942141245 Fix compiler warnings about appendStringInfoVA and appendStringInfoVA_s.
gcc was correctly complaining that these functions should be
declared with the `printf` format attribute. Addresses Issue #14.
2012-10-18 20:32:18 -07:00
Josh Kupershmidt
6c8c532701 Enforce version restriction (8.3+) in the Makefile, and further macro pruning.
Per Issue #12, have the Makefile bail out if the user is trying to build
on an unsupported Postgres version. Also, some further removal of macros
purportedly handling older PG versions which are no longer needed, and
were missed in 370e572.
2012-10-17 08:00:47 -07:00
Daniele Varrazzo
0a87822ee4 Avoid choosing an invalid index as primary key
Fixing the other functions selecting pg_index (as in Josh original patch)
doesn't seem necessary as they are only called with an index oid, and we
should only call them with a valid index as argument.
2012-10-17 00:01:00 +01:00
Daniele Varrazzo
9f5c4f55c7 Don't try to rebuild invalid indexes
Closes ticket #9
2012-10-16 23:29:36 +01:00
Josh Kupershmidt
df12c37edf Add in a call to:
ALTER TABLE [table_name] ENABLE ALWAYS TRIGGER z_reorg_trigger

so that pg_reorg and the z_reorg_trigger can properly work in "replica" mode,
as when using pg_reorg on a Slony slave.

Bug report and patch by Norman Yamada.
2012-10-14 10:50:05 -07:00
Josh Kupershmidt
bc20ace32b Use quote_identifier() to properly escape column names in UPDATE statement, per report from Dimitrije Radojevic. 2012-09-22 19:33:40 +01:00
Michael Paquier
153d81f50a Take care of warnings for unused parameters 2012-09-22 12:43:32 +01:00
Michael Paquier
805c3bb1f7 Add gitignore entries to ensure folder consistency 2012-09-22 12:43:26 +01:00
Masahiko Sakamoto
5e48cf02f9 Fixes to work with 9.3dev.
- included "access/htup_details.h", a newly introduced header for tuple.
- included "lib/stringinfo.h".
reported by josh.
2012-09-20 03:48:53 +00:00
Masahiko Sakamoto
f2fed2415d Fixes for 9.2devel. reported by Josh.
- Since 9.2, RenameRelationInternal() has changed its signature.
- In CREATE FUNCTION, LANGUAGE clause does not accept string.
2012-05-01 06:11:49 +00:00
Takahiro Itagaki
aad43aa1ae version 1.1.7. Supports 9.2dev. 2011-08-07 04:20:23 +00:00
Takahiro Itagaki
960930b645 Fixed database corruption when target tables have dropped columns, and
there are views or functions depending on columns after dropped ones.
The issue was reported by depesz, and original patch by Denish Patel.

Improved documentation how to build binaries from source.

COPYRIGHT updated.
2011-04-29 05:06:48 +00:00
Takahiro Itagaki
830ef422ad work around for 9.1. 2011-03-03 01:21:40 +00:00
Takahiro Itagaki
8ec3a085ad Added project configuration files for MSVC 2010 32/64bit. 2011-01-25 06:41:12 +00:00
Takahiro Itagaki
232c9bb6c9 Use one of not-null unique keys to identify rows when the target table doesn't
have a primary key. Some of users want to use not-null unique keys rather than
primary keys because postgres doesn't support REINDEX PRIMARY KEY CONCURRENTLY.

- Support 9.1dev.
- Improve Makefile to use PGXS automatically.
2011-01-06 09:35:15 +00:00
Masahiko Sakamoto
d8d39cc948 Fix memory leak and wrong usage of StringInfo in pgut_connect(). 2010-10-21 07:36:13 +00:00
Takahiro Itagaki
67a5d7b786 Fix a bug that pg_reorg cannot parse index definitions with reserved named columns,
i.e, it failed to parse quoted column names. (bug #1010828)
2010-06-14 05:11:26 +00:00
Takahiro Itagaki
79757ccb62 version 1.1.2. 2010-06-01 07:35:01 +00:00
Takahiro Itagaki
78b0a0e374 Fix two bugs.
#1010789 : pg_reorg 1.1.0 and "unexpected toast relations"
#1010790 : reorg.get_index_keys() does not handle composite indexes
2010-04-21 09:25:20 +00:00
Takahiro Itagaki
f3873ff55b pg_reorg version 1.1.0.
- Add wait-timeout option and use SET statement_timeout instead of NOWAIT.
  This can avoid infinite NOWAIT loops to reorganize heavily accessed tables.
- Support native build with MSVC on Windows.
2010-03-25 07:13:16 +00:00
Takahiro Itagaki
8392b9462a version 1.0.8. 2010-02-15 01:38:06 +00:00
Takahiro Itagaki
a7a42b7bbf Fix crashes when cluster indexes have storage options (fillfactor, etc). 2010-02-05 03:24:22 +00:00
Takahiro Itagaki
7084ec6de9 version 1.0.7. 2010-01-28 06:02:28 +00:00
Takahiro Itagaki
038c07523a Support reorganizing tables with non-default operator class. 2009-12-28 08:25:00 +00:00
Takahiro Itagaki
27e6839132 Release 1.0.6. Workaround for 8.2 and 8.3. 2009-07-03 05:52:31 +00:00
Takahiro Itagaki
2f2fa142b8 Add pgut-spi files. 2009-07-02 09:55:57 +00:00
Takahiro Itagaki
6155932b60 Fix data corruption bug reported by robjderr (#1010664).
pg_reorg broke catalog definition if the target table had any dropped columns.
Now pg_reorg removes dropped columns and renumbers valid columns.
You can use pg_reorg to shrink column definitions if you have many dropped
columns. (without pg_reorg, dropped columns are filled with zero forever)
2009-07-02 09:50:58 +00:00
Takahiro Itagaki
5fe3f037be version 1.0.5.
- Disable autovacuum for working tables and update logs.
- Do ANALYZE automatically after reorg unless -Z, --no-analyze option
  is specified.
2009-05-25 07:06:38 +00:00
Takahiro Itagaki
9a8f2e9c33 Fix ownership bug.
New toast table, toast index, and toast type should not have
been owned by the executor of pg_reorg, but by the original owner.
2009-05-14 08:19:25 +00:00
Takahiro Itagaki
0c659ed31f Fix compile errors on Linux. 2009-04-23 06:37:29 +00:00
Takahiro Itagaki
e1011e11fe Modify LOCK to LOCK-NOWAIT-and-loop at swap tables to avoid holding exclusive locks long time. Suggested by Kenny Gorman. 2009-04-16 06:01:01 +00:00
Takahiro Itagaki
942180c2d8 workaround with 8.2. 2009-01-27 01:35:53 +00:00
Takahiro Itagaki
aab19c7db0 Fixed a bug reorganizing tables without toast tables. 2009-01-23 02:33:11 +00:00
Takahiro Itagaki
24a03c01a5 workaround for toast tables. The bug is reported by Kenny Gorman. 2009-01-21 08:09:22 +00:00
Takahiro Itagaki
29469f40f9 Move drop function calls to another transaction which doesn't have execlusive locks. 2009-01-19 04:28:21 +00:00
Takahiro Itagaki
8af8be23ac Initial revision 2008-12-08 04:32:10 +00:00