Fork the pg_repack extension

This commit is contained in:
Daniele Varrazzo 2012-11-10 22:33:57 +00:00
parent 0f8c33f72f
commit b7799c1782
32 changed files with 416 additions and 416 deletions

View File

@ -1,15 +1,15 @@
{
"name": "pg_reorg",
"name": "pg_repack",
"abstract": "PostgreSQL module for data reorganization",
"description": "pg_reorg is a PostgreSQL module allowing to reorganize a table without any locks.",
"description": "pg_repack is a PostgreSQL module allowing to reorganize a table without any locks.",
"version": "1.2dev0",
"maintainer": "Takahiro Itagaki",
"tags": [ "bloat", "maintenance", "vacuum", "cluster" ],
"release_status": "stable",
"license": "bsd",
"provides": {
"pg_reorg": {
"file": "lib/pg_reorg.sql",
"pg_repack": {
"file": "lib/pg_repack.sql",
"version": "1.2dev0",
"abstract": "PostgreSQL module for data reorganization"
}
@ -22,7 +22,7 @@
}
},
"resources": {
"homepage": "http://reorg.projects.postgresql.org/",
"homepage": "http://repack.projects.postgresql.org/",
"bugtracker": {
"web": "http://pgfoundry.org/tracker/?atid=1376&group_id=1000411&func=browse"
}

View File

@ -1,5 +1,5 @@
#
# pg_reorg: Makefile
# pg_repack: Makefile
#
# Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
# Portions Copyright (c) 2011, Itagaki Takahiro
@ -17,7 +17,7 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = pg_reorg
subdir = pg_repack
include $(makefile_global)
include $(top_srcdir)/contrib/contrib-global.mk
endif
@ -29,7 +29,7 @@ VERSION = $(shell $(PG_CONFIG) --version | awk '{print $$2}')
# We support PostgreSQL 8.3 and later.
ifneq ($(shell echo $(VERSION) | grep -E "^7\.|^8\.[012]"),)
$(error pg_reorg requires PostgreSQL 8.3 or later. This is $(VERSION))
$(error pg_repack requires PostgreSQL 8.3 or later. This is $(VERSION))
endif

View File

@ -1,12 +1,12 @@
pg_reorg -- UNOFFICIAL REPOSITORY
pg_repack -- UNOFFICIAL REPOSITORY
=================================
This is NOT the official pg_reorg repository. Official development is
currently on pgFoundry: http://pgfoundry.org/projects/reorg
This is NOT the official pg_repack repository. Official development is
currently on pgFoundry: http://pgfoundry.org/projects/repack
This repository (and the url https://github.com/reorg) has been set up by me
This repository (and the url https://github.com/repack) has been set up by me
(Daniele) to provide greater visibility and easier contribution to the
pg_reorg project, an intention apparent from a recent `mailing list
pg_repack project, an intention apparent from a recent `mailing list
discussion`__.
.. __: http://archives.postgresql.org/pgsql-hackers/2012-09/msg00746.php
@ -18,9 +18,9 @@ administrative privileges, keeping total control of the project.
This repository has been created using the command::
git cvsimport -v -d :pserver:anonymous@cvs.pgfoundry.org:/cvsroot/reorg -A pg_reorg.auths -C pg_reorg -k -r cvs pg_reorg
git cvsimport -v -d :pserver:anonymous@cvs.pgfoundry.org:/cvsroot/repack -A pg_repack.auths -C pg_repack -k -r cvs pg_repack
with a suitably populated pg_reorg.auths.
with a suitably populated pg_repack.auths.
I assume new CSV commits will be added to ``remotes/cvs/master``, but I'm not
sure yet, so please consider this repository unstable until the development

View File

@ -1,6 +1,6 @@
# SPEC file for pg_reorg
# SPEC file for pg_repack
# Copyright(C) 2009-2010 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
%define sname pg_reorg
%define sname pg_repack
Summary: Reorganize tables in PostgreSQL databases without any locks.
Name: %{sname}
@ -16,7 +16,7 @@ BuildRequires: postgresql-devel, postgresql
Requires: postgresql, postgresql-libs
%description
pg_reorg can re-organize tables on a postgres database without any locks so that
pg_repack can re-organize tables on a postgres database without any locks so that
you can retrieve or update rows in tables being reorganized.
The module is developed to be a better alternative of CLUSTER and VACUUM FULL.
@ -34,20 +34,20 @@ install -d %{buildroot}%{_libdir}/pgsql
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}/pgsql/contrib
install -m 755 bin/pg_reorg %{buildroot}%{_bindir}/pg_reorg
install -m 755 lib/pg_reorg.so %{buildroot}%{_libdir}/pgsql/pg_reorg.so
install -m 644 lib/pg_reorg.sql %{buildroot}%{_datadir}/pgsql/contrib/pg_reorg.sql
install -m 644 lib/uninstall_pg_reorg.sql %{buildroot}%{_datadir}/pgsql/contrib/uninstall_pg_reorg.sql
install -m 755 bin/pg_repack %{buildroot}%{_bindir}/pg_repack
install -m 755 lib/pg_repack.so %{buildroot}%{_libdir}/pgsql/pg_repack.so
install -m 644 lib/pg_repack.sql %{buildroot}%{_datadir}/pgsql/contrib/pg_repack.sql
install -m 644 lib/uninstall_pg_repack.sql %{buildroot}%{_datadir}/pgsql/contrib/uninstall_pg_repack.sql
%define pg_sharedir
%files
%defattr(755,root,root,755)
%{_bindir}/pg_reorg
%{_libdir}/pgsql/pg_reorg.so
%{_bindir}/pg_repack
%{_libdir}/pgsql/pg_repack.so
%defattr(644,root,root,755)
%{_datadir}/pgsql/contrib/pg_reorg.sql
%{_datadir}/pgsql/contrib/uninstall_pg_reorg.sql
%{_datadir}/pgsql/contrib/pg_repack.sql
%{_datadir}/pgsql/contrib/uninstall_pg_repack.sql
%clean
rm -rf %{buildroot}

View File

@ -1,6 +1,6 @@
# SPEC file for pg_reorg
# SPEC file for pg_repack
# Copyright(C) 2009-2010 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
%define sname pg_reorg
%define sname pg_repack
%define _pgdir /usr/pgsql-9.0
%define _bindir %{_pgdir}/bin
@ -21,7 +21,7 @@ BuildRequires: postgresql90-devel, postgresql90
Requires: postgresql90, postgresql90-libs
%description
pg_reorg can re-organize tables on a postgres database without any locks so that
pg_repack can re-organize tables on a postgres database without any locks so that
you can retrieve or update rows in tables being reorganized.
The module is developed to be a better alternative of CLUSTER and VACUUM FULL.
@ -39,20 +39,20 @@ install -d %{buildroot}%{_libdir}
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}/contrib
install -m 755 bin/pg_reorg %{buildroot}%{_bindir}/pg_reorg
install -m 755 lib/pg_reorg.so %{buildroot}%{_libdir}/pg_reorg.so
install -m 644 lib/pg_reorg.sql %{buildroot}%{_datadir}/contrib/pg_reorg.sql
install -m 644 lib/uninstall_pg_reorg.sql %{buildroot}%{_datadir}/contrib/uninstall_pg_reorg.sql
install -m 755 bin/pg_repack %{buildroot}%{_bindir}/pg_repack
install -m 755 lib/pg_repack.so %{buildroot}%{_libdir}/pg_repack.so
install -m 644 lib/pg_repack.sql %{buildroot}%{_datadir}/contrib/pg_repack.sql
install -m 644 lib/uninstall_pg_repack.sql %{buildroot}%{_datadir}/contrib/uninstall_pg_repack.sql
%define pg_sharedir
%files
%defattr(755,root,root,755)
%{_bindir}/pg_reorg
%{_libdir}/pg_reorg.so
%{_bindir}/pg_repack
%{_libdir}/pg_repack.so
%defattr(644,root,root,755)
%{_datadir}/contrib/pg_reorg.sql
%{_datadir}/contrib/uninstall_pg_reorg.sql
%{_datadir}/contrib/pg_repack.sql
%{_datadir}/contrib/uninstall_pg_repack.sql
%clean
rm -rf %{buildroot}

2
bin/.gitignore vendored
View File

@ -1,5 +1,5 @@
/.deps/
/pg_reorg
/pg_repack
/results/
/sql/init.sql
/sql/init-*.*.sql

View File

@ -1,13 +1,13 @@
#
# pg_reorg: bin/Makefile
# pg_repack: bin/Makefile
#
# Portions Copyright (c) 2008-2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
# Portions Copyright (c) 2011, Itagaki Takahiro
#
SRCS = pg_reorg.c pgut/pgut.c pgut/pgut-fe.c
SRCS = pg_repack.c pgut/pgut.c pgut/pgut-fe.c
OBJS = $(SRCS:.c=.o)
PROGRAM = pg_reorg
REGRESS = init reorg
PROGRAM = pg_repack
REGRESS = init repack
EXTRA_CLEAN = sql/init-$(MAJORVERSION).sql sql/init.sql

View File

@ -111,12 +111,12 @@ SELECT * FROM tbl_with_dropped_toast;
(2 rows)
--
-- do reorg
-- do repack
--
\! pg_reorg --dbname=contrib_regression --no-order
\! pg_repack --dbname=contrib_regression --no-order
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
\! pg_reorg --dbname=contrib_regression
\! pg_reorg --dbname=contrib_regression --table=tbl_cluster
\! pg_repack --dbname=contrib_regression
\! pg_repack --dbname=contrib_regression --table=tbl_cluster
--
-- after
--
@ -298,13 +298,13 @@ CREATE TABLE tbl_nn (col1 int NOT NULL, col2 int NOT NULL);
CREATE TABLE tbl_uk (col1 int NOT NULL, col2 int , UNIQUE(col1, col2));
CREATE TABLE tbl_nn_uk (col1 int NOT NULL, col2 int NOT NULL, UNIQUE(col1, col2));
CREATE TABLE tbl_pk_uk (col1 int NOT NULL, col2 int NOT NULL, PRIMARY KEY(col1, col2), UNIQUE(col2, col1));
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_nn
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn
ERROR: relation "tbl_nn" must have a primary key or not-null unique keys
-- => ERROR
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_uk
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_uk
ERROR: relation "tbl_uk" must have a primary key or not-null unique keys
-- => ERROR
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_nn_uk
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn_uk
-- => OK
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_pk_uk
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_pk_uk
-- => OK

View File

@ -1,5 +1,5 @@
/*
* pg_reorg.c: bin/pg_reorg.c
* pg_repack.c: bin/pg_repack.c
*
* Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
* Portions Copyright (c) 2011, Itagaki Takahiro
@ -10,8 +10,8 @@
*/
const char *PROGRAM_VERSION = "1.1.7";
const char *PROGRAM_URL = "http://reorg.projects.postgresql.org/";
const char *PROGRAM_EMAIL = "reorg-general@lists.pgfoundry.org";
const char *PROGRAM_URL = "http://repack.projects.postgresql.org/";
const char *PROGRAM_EMAIL = "repack-general@lists.pgfoundry.org";
#include "pgut/pgut-fe.h"
@ -30,7 +30,7 @@ const char *PROGRAM_EMAIL = "reorg-general@lists.pgfoundry.org";
* servers. See GH ticket #1.
*/
#define SQL_XID_SNAPSHOT \
"SELECT reorg.array_accum(virtualtransaction) FROM pg_locks"\
"SELECT repack.array_accum(virtualtransaction) FROM pg_locks"\
" WHERE locktype = 'virtualxid' AND pid <> pg_backend_pid()"\
" AND (virtualxid, virtualtransaction) <> ('1/1', '-1/0')"
@ -41,7 +41,7 @@ const char *PROGRAM_EMAIL = "reorg-general@lists.pgfoundry.org";
/*
* per-table information
*/
typedef struct reorg_table
typedef struct repack_table
{
const char *target_name; /* target: relname */
Oid target_oid; /* target: OID */
@ -51,8 +51,8 @@ typedef struct reorg_table
Oid ckid; /* target: CK OID */
const char *create_pktype; /* CREATE TYPE pk */
const char *create_log; /* CREATE TABLE log */
const char *create_trigger; /* CREATE TRIGGER z_reorg_trigger */
const char *alter_table; /* ALTER TABLE ENABLE ALWAYS TRIGGER z_reorg_trigger */
const char *create_trigger; /* CREATE TRIGGER z_repack_trigger */
const char *alter_table; /* ALTER TABLE ENABLE ALWAYS TRIGGER z_repack_trigger */
const char *create_table; /* CREATE TABLE table AS SELECT */
const char *drop_columns; /* ALTER TABLE DROP COLUMNs */
const char *delete_log; /* DELETE FROM log */
@ -62,21 +62,21 @@ typedef struct reorg_table
const char *sql_delete; /* SQL used in flush */
const char *sql_update; /* SQL used in flush */
const char *sql_pop; /* SQL used in flush */
} reorg_table;
} repack_table;
/*
* per-index information
*/
typedef struct reorg_index
typedef struct repack_index
{
Oid target_oid; /* target: OID */
const char *create_index; /* CREATE INDEX */
} reorg_index;
} repack_index;
static void reorg_all_databases(const char *order_by);
static bool reorg_one_database(const char *order_by, const char *table);
static void reorg_one_table(const reorg_table *table, const char *order_by);
static void reorg_cleanup(bool fatal, void *userdata);
static void repack_all_databases(const char *order_by);
static bool repack_one_database(const char *order_by, const char *table);
static void repack_one_table(const repack_table *table, const char *order_by);
static void repack_cleanup(bool fatal, void *userdata);
static char *getstr(PGresult *res, int row, int col);
static Oid getoid(PGresult *res, int row, int col);
@ -138,12 +138,12 @@ main(int argc, char *argv[])
if (table)
ereport(ERROR,
(errcode(EINVAL),
errmsg("cannot reorg a specific table in all databases")));
reorg_all_databases(orderby);
errmsg("cannot repack a specific table in all databases")));
repack_all_databases(orderby);
}
else
{
if (!reorg_one_database(orderby, table))
if (!repack_one_database(orderby, table))
ereport(ERROR,
(errcode(ENOENT),
errmsg("%s is not installed", PROGRAM_NAME)));
@ -153,10 +153,10 @@ main(int argc, char *argv[])
}
/*
* Call reorg_one_database for each database.
* Call repack_one_database for each database.
*/
static void
reorg_all_databases(const char *orderby)
repack_all_databases(const char *orderby)
{
PGresult *result;
int i;
@ -174,11 +174,11 @@ reorg_all_databases(const char *orderby)
if (pgut_log_level >= INFO)
{
printf("%s: reorg database \"%s\"", PROGRAM_NAME, dbname);
printf("%s: repack database \"%s\"", PROGRAM_NAME, dbname);
fflush(stdout);
}
ret = reorg_one_database(orderby, NULL);
ret = repack_one_database(orderby, NULL);
if (pgut_log_level >= INFO)
{
@ -213,10 +213,10 @@ getoid(PGresult *res, int row, int col)
}
/*
* Call reorg_one_table for the target table or each table in a database.
* Call repack_one_table for the target table or each table in a database.
*/
static bool
reorg_one_database(const char *orderby, const char *table)
repack_one_database(const char *orderby, const char *table)
{
bool ret = true;
PGresult *res;
@ -238,7 +238,7 @@ reorg_one_database(const char *orderby, const char *table)
command("SET client_min_messages = warning", 0, NULL);
/* acquire target tables */
appendStringInfoString(&sql, "SELECT * FROM reorg.tables WHERE ");
appendStringInfoString(&sql, "SELECT * FROM repack.tables WHERE ");
if (table)
{
appendStringInfoString(&sql, "relid = $1::regclass");
@ -256,7 +256,7 @@ reorg_one_database(const char *orderby, const char *table)
{
if (sqlstate_equals(res, SQLSTATE_INVALID_SCHEMA_NAME))
{
/* Schema reorg does not exist. Skip the database. */
/* Schema repack does not exist. Skip the database. */
ret = false;
goto cleanup;
}
@ -273,7 +273,7 @@ reorg_one_database(const char *orderby, const char *table)
for (i = 0; i < num; i++)
{
reorg_table table;
repack_table table;
const char *create_table;
const char *ckey;
int c = 0;
@ -330,7 +330,7 @@ reorg_one_database(const char *orderby, const char *table)
table.sql_update = getstr(res, i, c++);
table.sql_pop = getstr(res, i, c++);
reorg_one_table(&table, orderby);
repack_one_table(&table, orderby);
}
cleanup:
@ -341,7 +341,7 @@ cleanup:
}
static int
apply_log(const reorg_table *table, int count)
apply_log(const repack_table *table, int count)
{
int result;
PGresult *res;
@ -355,7 +355,7 @@ apply_log(const reorg_table *table, int count)
params[4] = table->sql_pop;
params[5] = utoa(count, buffer);
res = execute("SELECT reorg.reorg_apply($1, $2, $3, $4, $5, $6)",
res = execute("SELECT repack.repack_apply($1, $2, $3, $4, $5, $6)",
6, params);
result = atoi(PQgetvalue(res, 0, 0));
PQclear(res);
@ -367,7 +367,7 @@ apply_log(const reorg_table *table, int count)
* Re-organize one table.
*/
static void
reorg_one_table(const reorg_table *table, const char *orderby)
repack_one_table(const repack_table *table, const char *orderby)
{
PGresult *res;
const char *params[1];
@ -380,7 +380,7 @@ reorg_one_table(const reorg_table *table, const char *orderby)
initStringInfo(&sql);
elog(DEBUG2, "---- reorg_one_table ----");
elog(DEBUG2, "---- repack_one_table ----");
elog(DEBUG2, "target_name : %s", table->target_name);
elog(DEBUG2, "target_oid : %u", table->target_oid);
elog(DEBUG2, "target_toast : %u", table->target_toast);
@ -408,12 +408,12 @@ reorg_one_table(const reorg_table *table, const char *orderby)
lock_exclusive(utoa(table->target_oid, buffer), table->lock_table);
/*
* Check z_reorg_trigger is the trigger executed at last so that
* Check z_repack_trigger is the trigger executed at last so that
* other before triggers cannot modify triggered tuples.
*/
params[0] = utoa(table->target_oid, buffer);
res = execute("SELECT reorg.conflicted_triggers($1)", 1, params);
res = execute("SELECT repack.conflicted_triggers($1)", 1, params);
if (PQntuples(res) > 0)
ereport(ERROR,
(errcode(E_PG_COMMAND),
@ -425,7 +425,7 @@ reorg_one_table(const reorg_table *table, const char *orderby)
command(table->create_log, 0, NULL);
command(table->create_trigger, 0, NULL);
command(table->alter_table, 0, NULL);
printfStringInfo(&sql, "SELECT reorg.disable_autovacuum('reorg.log_%u')", table->target_oid);
printfStringInfo(&sql, "SELECT repack.disable_autovacuum('repack.log_%u')", table->target_oid);
command(sql.data, 0, NULL);
command("COMMIT", 0, NULL);
@ -434,7 +434,7 @@ reorg_one_table(const reorg_table *table, const char *orderby)
* an advisory lock. The registration should be done after
* the first command succeeds.
*/
pgut_atexit_push(&reorg_cleanup, (void *) table);
pgut_atexit_push(&repack_cleanup, (void *) table);
/*
* 2. Copy tuples into temp table.
@ -451,7 +451,7 @@ reorg_one_table(const reorg_table *table, const char *orderby)
PQclear(res);
command(table->delete_log, 0, NULL);
command(table->create_table, 0, NULL);
printfStringInfo(&sql, "SELECT reorg.disable_autovacuum('reorg.table_%u')", table->target_oid);
printfStringInfo(&sql, "SELECT repack.disable_autovacuum('repack.table_%u')", table->target_oid);
if (table->drop_columns)
command(table->drop_columns, 0, NULL);
command(sql.data, 0, NULL);
@ -464,7 +464,7 @@ reorg_one_table(const reorg_table *table, const char *orderby)
params[0] = utoa(table->target_oid, buffer);
res = execute("SELECT indexrelid,"
" reorg.reorg_indexdef(indexrelid, indrelid),"
" repack.repack_indexdef(indexrelid, indrelid),"
" indisvalid,"
" pg_get_indexdef(indexrelid)"
" FROM pg_index WHERE indrelid = $1", 1, params);
@ -472,7 +472,7 @@ reorg_one_table(const reorg_table *table, const char *orderby)
num = PQntuples(res);
for (i = 0; i < num; i++)
{
reorg_index index;
repack_index index;
int c = 0;
const char *isvalid;
const char *indexdef;
@ -548,7 +548,7 @@ reorg_one_table(const reorg_table *table, const char *orderby)
lock_exclusive(utoa(table->target_oid, buffer), table->lock_table);
apply_log(table, 0);
params[0] = utoa(table->target_oid, buffer);
command("SELECT reorg.reorg_swap($1)", 1, params);
command("SELECT repack.repack_swap($1)", 1, params);
command("COMMIT", 0, NULL);
/*
@ -558,10 +558,10 @@ reorg_one_table(const reorg_table *table, const char *orderby)
command("BEGIN ISOLATION LEVEL READ COMMITTED", 0, NULL);
params[0] = utoa(table->target_oid, buffer);
command("SELECT reorg.reorg_drop($1)", 1, params);
command("SELECT repack.repack_drop($1)", 1, params);
command("COMMIT", 0, NULL);
pgut_atexit_pop(&reorg_cleanup, (void *) table);
pgut_atexit_pop(&repack_cleanup, (void *) table);
free(vxid);
/*
@ -660,9 +660,9 @@ lock_exclusive(const char *relid, const char *lock_query)
* objects before the program exits.
*/
static void
reorg_cleanup(bool fatal, void *userdata)
repack_cleanup(bool fatal, void *userdata)
{
const reorg_table *table = (const reorg_table *) userdata;
const repack_table *table = (const repack_table *) userdata;
if (fatal)
{
@ -683,7 +683,7 @@ reorg_cleanup(bool fatal, void *userdata)
/* do cleanup */
params[0] = utoa(table->target_oid, buffer);
command("SELECT reorg.reorg_drop($1)", 1, params);
command("SELECT repack.repack_drop($1)", 1, params);
}
}
@ -698,10 +698,10 @@ pgut_help(bool details)
return;
printf("Options:\n");
printf(" -a, --all reorg all databases\n");
printf(" -a, --all repack all databases\n");
printf(" -n, --no-order do vacuum full instead of cluster\n");
printf(" -o, --order-by=columns order by columns instead of cluster keys\n");
printf(" -t, --table=TABLE reorg specific table only\n");
printf(" -t, --table=TABLE repack specific table only\n");
printf(" -T, --wait-timeout=secs timeout to cancel other backends on conflict\n");
printf(" -Z, --no-analyze don't analyze at end\n");
}

View File

@ -1,5 +1,5 @@
SET client_min_messages = warning;
\set ECHO none
CREATE EXTENSION pg_reorg;
CREATE EXTENSION pg_repack;
\set ECHO all
RESET client_min_messages;

View File

@ -1,5 +1,5 @@
SET client_min_messages = warning;
\set ECHO none
\i ../lib/pg_reorg.sql
\i ../lib/pg_repack.sql
\set ECHO all
RESET client_min_messages;

View File

@ -113,12 +113,12 @@ SELECT * FROM view_for_dropped_column;
SELECT * FROM tbl_with_dropped_toast;
--
-- do reorg
-- do repack
--
\! pg_reorg --dbname=contrib_regression --no-order
\! pg_reorg --dbname=contrib_regression
\! pg_reorg --dbname=contrib_regression --table=tbl_cluster
\! pg_repack --dbname=contrib_regression --no-order
\! pg_repack --dbname=contrib_regression
\! pg_repack --dbname=contrib_regression --table=tbl_cluster
--
-- after
@ -171,11 +171,11 @@ CREATE TABLE tbl_nn (col1 int NOT NULL, col2 int NOT NULL);
CREATE TABLE tbl_uk (col1 int NOT NULL, col2 int , UNIQUE(col1, col2));
CREATE TABLE tbl_nn_uk (col1 int NOT NULL, col2 int NOT NULL, UNIQUE(col1, col2));
CREATE TABLE tbl_pk_uk (col1 int NOT NULL, col2 int NOT NULL, PRIMARY KEY(col1, col2), UNIQUE(col2, col1));
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_nn
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn
-- => ERROR
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_uk
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_uk
-- => ERROR
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_nn_uk
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_nn_uk
-- => OK
\! pg_reorg --dbname=contrib_regression --no-order --table=tbl_pk_uk
\! pg_repack --dbname=contrib_regression --no-order --table=tbl_pk_uk
-- => OK

View File

@ -8,20 +8,20 @@
<link rel="icon" type="image/png" href="http://pgfoundry.org/images/elephant-icon.png" />
<link rel="stylesheet" type="text/css" href="style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>pg_reorg: Project Home Page</title>
<title>pg_repack: Project Home Page</title>
</head>
<body>
<center><img style="border: none; margin-left: auto; margin-right: auto; " src="http://pgfoundry.org/images/elephantSmall.png" height="75" width="75" />
<hr />
<h1>pg_reorg ホームページへようこそ</h1>
<h1>pg_repack ホームページへようこそ</h1>
<hr />
</center>
<p>このプロジェクトでは <strong>pg_reorg</strong><strong>pg_batch</strong> の2つのツールを頒布しています。</p>
<p>このプロジェクトでは <strong>pg_repack</strong><strong>pg_batch</strong> の2つのツールを頒布しています。</p>
<p>
<strong>pg_reorg</strong> は PostgreSQL のテーブルを再編成するシェルコマンドです。
<strong>pg_repack</strong> は PostgreSQL のテーブルを再編成するシェルコマンドです。
共有ロックや排他ロックを取得しないため、再編成中であっても行の参照や更新を行うことができます。
このモジュールは CLUSTER や VACUUM FULL コマンドのより良い代替になります。
</p>
@ -32,7 +32,7 @@
VACUUM を行うスクリプトが付属しており、"より良い vacuumdb" として利用できます。
</p>
<p>この pg_reorg プロジェクトは <a href="http://www.postgresql.org">PostgreSQL</a> コミュニティによる <a href="http://pgfoundry.org">pgFoundry</a> の中の<a href="http://pgfoundry.org/projects/reorg">プロジェクト</a>です。</p>
<p>この pg_repack プロジェクトは <a href="http://www.postgresql.org">PostgreSQL</a> コミュニティによる <a href="http://pgfoundry.org">pgFoundry</a> の中の<a href="http://pgfoundry.org/projects/repack">プロジェクト</a>です。</p>
<ul>
<li><a href="http://pgfoundry.org/frs/?group_id=1000411">ダウンロード</a> : ソースコードのほか、Windows 用バイナリもダウンロードできます。</li>
<li><a href="http://pgfoundry.org/tracker/?group_id=1000411">バグレポート</li></li>
@ -46,15 +46,15 @@ VACUUM を行うスクリプトが付属しており、"より良い vacuumdb"
<h2>ドキュメント</h2>
<ul>
<li><a href="pg_reorg-ja.html">pg_reorg 1.1 ドキュメント</a></li>
<li><a href="pg_repack-ja.html">pg_repack 1.1 ドキュメント</a></li>
<li><a href="pg_batch-ja.html">pg_batch 1.2 ドキュメント</a></li>
</ul>
<h2>実行時間</h2>
<p>
pg_reorg とclusterdb の比較に示します。
断片化のないソートされた状態 (not fragmented) では clusterdb のほうが高速ですが、完全に断片化した状態 (fully fragmented) では pg_reorg が大幅に高速です。
一般的に、再編成は断片化が進行した状態で実施されることを考えると、pg_reorg は clusterdb よりも実行時間が短いと言えます。
pg_repack とclusterdb の比較に示します。
断片化のないソートされた状態 (not fragmented) では clusterdb のほうが高速ですが、完全に断片化した状態 (fully fragmented) では pg_repack が大幅に高速です。
一般的に、再編成は断片化が進行した状態で実施されることを考えると、pg_repack は clusterdb よりも実行時間が短いと言えます。
</p>
<center>
@ -92,7 +92,7 @@ pg_reorg とclusterdb の比較に示します。
<td>PostgreSQL 8.3.3</td>
</tr>
<tr>
<td>pg_reorg</td>
<td>pg_repack</td>
<td>1.0.0</td>
</tr>
<tr>

View File

@ -8,22 +8,22 @@
<link rel="icon" type="image/png" href="http://pgfoundry.org/images/elephant-icon.png" />
<link rel="stylesheet" type="text/css" href="style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>pg_reorg: Project Home Page</title>
<title>pg_repack: Project Home Page</title>
</head>
<body>
<center><img style="border: none; margin-left: auto; margin-right: auto; " src="http://pgfoundry.org/images/elephantSmall.png" height="75" width="75" />
<hr />
<h1>Welcome to the pg_reorg Project Home Page</h1>
<h1>Welcome to the pg_repack Project Home Page</h1>
<hr />
</center>
<p>
This project provides two tools for PostgreSQL; <strong>pg_reorg</strong> and <strong>pg_batch</strong>.
This project provides two tools for PostgreSQL; <strong>pg_repack</strong> and <strong>pg_batch</strong>.
</p>
<p>
<strong>pg_reorg</strong> can re-organize tables on a postgres database without any locks so that you can retrieve or update rows in tables being reorganized.
<strong>pg_repack</strong> can re-organize tables on a postgres database without any locks so that you can retrieve or update rows in tables being reorganized.
The module is developed to be a better alternative of CLUSTER and VACUUM FULL.
</p>
@ -34,10 +34,10 @@ It can be used as "a better vacuumdb" with the attached script to run VACUUM.
</p>
<p>
The pg_reorg project is a <a href="http://www.postgresql.org">PostgreSQL</a> Community project that is a part of the <a href="http://pgfoundry.org">pgFoundry</a>.
The pg_repack project is a <a href="http://www.postgresql.org">PostgreSQL</a> Community project that is a part of the <a href="http://pgfoundry.org">pgFoundry</a>.
</p>
<p>
The pgFoundry page for the project is at <a href="http://pgfoundry.org/projects/reorg">http://pgfoundry.org/projects/reorg</a>,
The pgFoundry page for the project is at <a href="http://pgfoundry.org/projects/repack">http://pgfoundry.org/projects/repack</a>,
where you can find <a href="http://pgfoundry.org/frs/?group_id=1000411">downloads</a>, documentation, bug reports, mailing lists, and a whole lot more.
</p>
<div>
@ -48,15 +48,15 @@ where you can find <a href="http://pgfoundry.org/frs/?group_id=1000411">download
<h2>Documentation</h2>
<ul>
<li><a href="pg_reorg.html">pg_reorg 1.1 documentation</a></li>
<li><a href="pg_repack.html">pg_repack 1.1 documentation</a></li>
<li><a href="pg_batch.html">pg_batch 1.2 documentation</a></li>
</ul>
<h2>Execution time</h2>
<p>
Here is a comparison between pg_reorg and clusterdb.
Clusterdb is faster on not fragmented conditions, but pg_reorg is faster on fully fragmented conditions.
Since reorganization is needed only if tables are fragmented, pg_reorg should be faster than clusterdb.
Here is a comparison between pg_repack and clusterdb.
Clusterdb is faster on not fragmented conditions, but pg_repack is faster on fully fragmented conditions.
Since reorganization is needed only if tables are fragmented, pg_repack should be faster than clusterdb.
</p>
<center>
@ -94,7 +94,7 @@ Since reorganization is needed only if tables are fragmented, pg_reorg should be
<td>PostgreSQL 8.3.3</td>
</tr>
<tr>
<td>pg_reorg</td>
<td>pg_repack</td>
<td>1.0.0</td>
</tr>
<tr>

View File

@ -1,17 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>pg_reorg</title>
<link rel="home" title="pg_reorg " href="index.html">
<title>pg_repack</title>
<link rel="home" title="pg_repack " href="index.html">
<link rel="stylesheet" TYPE="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1 id="pg_reorg">pg_reorg 1.1.7</h1>
<h1 id="pg_repack">pg_repack 1.1.7</h1>
<div class="navigation">
<a href="index-ja.html">Top</a> &gt;
<a href="pg_reorg-ja.html">pg_reorg</a>
<a href="pg_repack-ja.html">pg_repack</a>
</div>
<hr>
@ -33,11 +33,11 @@
</div>
<h2 id="name">名前</h2>
pg_reorg -- PostgreSQLデータベース内のテーブルに対して、参照/更新処理をブロックせずに再編成を行います。
pg_repack -- PostgreSQLデータベース内のテーブルに対して、参照/更新処理をブロックせずに再編成を行います。
<h2 id="synopsis">概要</h2>
<p>
pg_reorg [OPTIONS]
pg_repack [OPTIONS]
</p>
<p>オプション OPTIONS には以下を指定できます。
@ -68,7 +68,7 @@ pg_reorg [OPTIONS]
</ul>
<h2 id="description">説明</h2>
<p>pg_reorg は、PostgreSQLデータベース内のテーブルを再編成(行の並び替え)するユーティリティです。
<p>pg_repack は、PostgreSQLデータベース内のテーブルを再編成(行の並び替え)するユーティリティです。
<a href="http://www.postgresql.jp/document/current/html/app-clusterdb.html">clusterdb</a> と異なり、参照/更新処理をブロックしません。
再編成の方式として、以下のいずれか1つを選択できます。</p>
<ul>
@ -84,16 +84,16 @@ pg_reorg [OPTIONS]
<h2 id="examples"></h2>
<p>testというデータベースをオンライン CLUSTER するには、下記のコマンドを実行します。</p>
<PRE><SAMP>$ </SAMP><KBD>pg_reorg test</KBD></PRE>
<PRE><SAMP>$ </SAMP><KBD>pg_repack test</KBD></PRE>
<p>testという名前のデータベースのfooという1つのテーブルに対してオンライン VACUUM FULL を行うには、下記のコマンドを実行します。</p>
<PRE><SAMP>$ </SAMP><KBD>pg_reorg --no-order --table foo -d test</KBD></PRE><p>
<PRE><SAMP>$ </SAMP><KBD>pg_repack --no-order --table foo -d test</KBD></PRE><p>
</p>
<h2 id="options">オプション</h2>
<p>pg_reorg では、下記のコマンドライン引数を指定できます。</p>
<p>pg_repack では、下記のコマンドライン引数を指定できます。</p>
<h3>固有オプション</h3>
<p>pg_reorg を実行する対象と並び替えの基準を指定するパラメータです。
<p>pg_repack を実行する対象と並び替えの基準を指定するパラメータです。
何も指定されていない場合は、cluster index順にオンライン CLUSTER を行います。
この2つを同時に指定することはできません。
</p>
@ -210,19 +210,19 @@ DEBUG, INFO, NOTICE, WARNING, ERROR, LOG, FATAL, PANIC から選択します。
</p>
<h2 id="diagnostics">トラブルシューティング</h2>
<p>pg_reorg の実行に失敗した場合にエラーが表示されます。
<p>pg_repack の実行に失敗した場合にエラーが表示されます。
想像されるエラー原因と対処を示します。</p>
<p>致命的なエラーで終了した場合、手動によるクリーンアップを行う必要があります。
クリーンアップは、エラーが発生したデータベースに対して、$PGHOME/share/contrib/uninstall_pg_reorg.sql を実行し、その後、$PGHOME/share/contrib/pg_reorg.sql を実行します。</p>
クリーンアップは、エラーが発生したデータベースに対して、$PGHOME/share/contrib/uninstall_pg_repack.sql を実行し、その後、$PGHOME/share/contrib/pg_repack.sql を実行します。</p>
<dl>
<dt>pg_reorg : reorg database "template1" ... skipped</dt>
<dd>--allオプションを指定した際に、pg_reorg がインストールされていないデータベースに対して表示されます。</dd>
<dd>pg_reorg スキーマのインストールを行ってください。</dd>
<dt>pg_repack : repack database "template1" ... skipped</dt>
<dd>--allオプションを指定した際に、pg_repack がインストールされていないデータベースに対して表示されます。</dd>
<dd>pg_repack スキーマのインストールを行ってください。</dd>
<dt>ERROR: pg_reorg is not installed</dt>
<dd>--dbnameで指定したデータベースにpg_reorg がインストールされていません。</dd>
<dd>pg_reorg のインストールを行ってください。</dd>
<dt>ERROR: pg_repack is not installed</dt>
<dd>--dbnameで指定したデータベースにpg_repack がインストールされていません。</dd>
<dd>pg_repack のインストールを行ってください。</dd>
<dt>ERROR: relation "table" has no primary key</dt>
<dd>指定したテーブルにPRIMARY KEYが存在していません。</dd>
@ -232,45 +232,45 @@ DEBUG, INFO, NOTICE, WARNING, ERROR, LOG, FATAL, PANIC から選択します。
<dd>指定したテーブルに CLUSTER KEYが存在していません。</dd>
<dd>対象のテーブルに CLUSTER KEYの作成を行ってください。(ALTER TABLE CLUSTER)</dd>
<dt>pg_reorg : query failed: ERROR: column "col" does not exist</dt>
<dt>pg_repack : query failed: ERROR: column "col" does not exist</dt>
<dd>--order-by で指定したカラムが対象のテーブルに存在していません。</dd>
<dd>対象のテーブルに存在するカラムを指定してください。</dd>
<dt>ERROR: permission denied for schema reorg</dt>
<dt>ERROR: permission denied for schema repack</dt>
<dd>操作を行おうとした対象に権限がありません。</dd>
<dd>スーパーユーザで操作を行ってください。</dd>
<dt>pg_reorg : query failed: ERROR: trigger "z_reorg_trigger" for relation "tbl" already exists</dt>
<dd>操作を行おうとした対象にpg_reorg が処理のために作成するトリガと同名のものが存在しています。</dd>
<dt>pg_repack : query failed: ERROR: trigger "z_repack_trigger" for relation "tbl" already exists</dt>
<dd>操作を行おうとした対象にpg_repack が処理のために作成するトリガと同名のものが存在しています。</dd>
<dd>トリガの改名か削除を行ってください。</dd>
<dt>pg_reorg : trigger conflicted for tbl</dt>
<dd>操作を行おうとした対象にpg_reorg が処理のために作成するトリガより後に実行されるトリガが存在しています。</dd>
<dt>pg_repack : trigger conflicted for tbl</dt>
<dd>操作を行おうとした対象にpg_repack が処理のために作成するトリガより後に実行されるトリガが存在しています。</dd>
<dd>トリガの改名か削除を行ってください。</dd>
</dl>
<h2 id="restrictions">使用上の注意と制約</h2>
<p>pg_reorg を使用する際には、以下の制約があります。以下の制約に関する操作を行った場合の動作は保証されません。注意してください。</p>
<p>pg_repack を使用する際には、以下の制約があります。以下の制約に関する操作を行った場合の動作は保証されません。注意してください。</p>
<h3>一時テーブルへの操作</h3>
<p>pg_reorg では、一時テーブルは操作の対象外です。</p>
<p>pg_repack では、一時テーブルは操作の対象外です。</p>
<h3>GiSTインデックスの使用</h3>
<p>インデックス種別がGiSTとなっているインデックスがクラスタインデックスとなっている
テーブルはpg_reorg コマンドを使用して操作を行うことはできません。
テーブルはpg_repack コマンドを使用して操作を行うことはできません。
これは、GiSTインデックスのソート順序は一意ではないため、ORDER BYによる
ソートが行えないためです。</p>
<h3>DDLコマンドの発行</h3>
<p>
pg_reorg の実行中には、VACUUM と ANALYZE <STRONG>以外</STRONG> のDDL操作は行わないでください。
多くの場合、pg_reorg は失敗しロールバックされます。
pg_repack の実行中には、VACUUM と ANALYZE <STRONG>以外</STRONG> のDDL操作は行わないでください。
多くの場合、pg_repack は失敗しロールバックされます。
しかし、以下の操作ではデータが破損するため、非常に危険です。
</p>
<dl>
<dt>TRUNCATE</dt>
<dd>削除した行が pg_reorg 実行後には復元しています。操作結果が消失します。</dd>
<dd>削除した行が pg_repack 実行後には復元しています。操作結果が消失します。</dd>
<dt>CREATE INDEX</dt>
<dd>スワップされない索引が残る可能性があります。データの不整合が生じます。</dd>
@ -282,11 +282,11 @@ pg_reorg の実行中には、VACUUM と ANALYZE <STRONG>以外</STRONG> のDDL
<dd>実行するとスキーマで定義された型と実際の格納状態に齟齬をきたします。データの不整合が生じます。</dd>
<dt>ALTER TABLE ... SET TABLESPACE</dt>
<dd>pg_reorg 実行後にrelfilenodeとの不整合が起こるため、対象のテーブルに対する参照/更新操作時にエラーが発生します。</dd>
<dd>pg_repack 実行後にrelfilenodeとの不整合が起こるため、対象のテーブルに対する参照/更新操作時にエラーが発生します。</dd>
</dl>
<h2 id="details">詳細</h2>
<p>pg_reorg は reorg スキーマに作業用テーブルを作成し、そこでデータの並び替えを行います。
<p>pg_repack は repack スキーマに作業用テーブルを作成し、そこでデータの並び替えを行います。
最後にシステムカタログを直接書き換えることで、元のテーブルと名前を交換しています。</p>
<h2 id="install">インストール方法</h2>
@ -294,7 +294,7 @@ pg_reorg の実行中には、VACUUM と ANALYZE <STRONG>以外</STRONG> のDDL
UNIX や Linux では、make を実行すると自動的に pgxs を使ってビルドできます。
前もって PostgreSQL 開発用パッケージ (postgresql-devel 等) をインストールし、pg_config にパスを通してください。
</p>
<pre>$ cd pg_reorg
<pre>$ cd pg_repack
$ make
$ su
$ make install</pre>
@ -305,7 +305,7 @@ msvc フォルダ内にプロジェクトファイルがあります。
<p>その後、データベースに関数を登録します。</p>
<pre>$ pg_ctl start
$ psql -f $PGSHARE/contrib/pg_reorg.sql -d your_database</pre>
$ psql -f $PGSHARE/contrib/pg_repack.sql -d your_database</pre>
<p>(注意: <code>CREATE EXTENSION</code> はまだサポートしていません。)</p>
@ -334,7 +334,7 @@ $ psql -f $PGSHARE/contrib/pg_reorg.sql -d your_database</pre>
<hr>
<div class="navigation">
<a href="index-ja.html">Top</a> &gt;
<a href="pg_reorg-ja.html">pg_reorg</a>
<a href="pg_repack-ja.html">pg_repack</a>
</div>
<p class="footer">
Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION<br>

View File

@ -1,17 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>pg_reorg</title>
<link rel="home" title="pg_reorg " href="index.html">
<title>pg_repack</title>
<link rel="home" title="pg_repack " href="index.html">
<link rel="stylesheet" TYPE="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1 id="pg_reorg">pg_reorg 1.1.7</h1>
<h1 id="pg_repack">pg_repack 1.1.7</h1>
<div class="navigation">
<a href="index.html">Top</a> &gt;
<a href="pg_reorg.html">pg_reorg</a>
<a href="pg_repack.html">pg_repack</a>
</div>
<hr>
@ -33,11 +33,11 @@
</div>
<h2 id="name">Name</h2>
pg_reorg -- Reorganize tables in PostgreSQL databases without any locks.
pg_repack -- Reorganize tables in PostgreSQL databases without any locks.
<h2 id="synopsis">Synopsis</h2>
<p>
pg_reorg [OPTIONS]
pg_repack [OPTIONS]
</p>
<p>The following options can be specified in OPTIONS.
@ -68,7 +68,7 @@ See also "<a href="#options">Options</a>" for details.</p>
</ul>
<h2 id="description">Description</h2>
<p>pg_reorg is an utility program to reorganize tables in PostgreSQL databases.
<p>pg_repack is an utility program to reorganize tables in PostgreSQL databases.
Unlike <a href="http://developer.postgresql.org/pgdocs/postgres/app-clusterdb.html">clusterdb</a>, it doesn't block any selections and updates during reorganization.
You can choose one of the following methods to reorganize.</p>
<ul>
@ -84,17 +84,17 @@ You can choose one of the following methods to reorganize.</p>
<h2 id="examples">Examples</h2>
<p>Execute the following command to perform an online CLUSTER of all tables in test database.</p>
<PRE><SAMP>$ </SAMP><KBD>pg_reorg test</KBD></PRE>
<PRE><SAMP>$ </SAMP><KBD>pg_repack test</KBD></PRE>
<p>Execute the following command to perform an online VACUUM FULL to foo table in test database.</p>
<PRE><SAMP>$ </SAMP><KBD>pg_reorg --no-order --table foo -d test</KBD></PRE><p>
<PRE><SAMP>$ </SAMP><KBD>pg_repack --no-order --table foo -d test</KBD></PRE><p>
</p>
<h2 id="options">Options</h2>
<p>pg_reorg has the following command line options:</p>
<p>pg_repack has the following command line options:</p>
<h3>Reorg Options</h3>
<p>Options to order rows.
If not specified, pg_reorg performs an online CLUSTER using cluster indexes.
If not specified, pg_repack performs an online CLUSTER using cluster indexes.
Only one option can be specified.
You may also specify target tables or databases.
@ -119,10 +119,10 @@ You may also specify target tables or databases.
--wait-timeout=seconds
</dt>
<dd>
pg_reorg needs to take an exclusive lock at the end of the reorganization.
pg_repack needs to take an exclusive lock at the end of the reorganization.
This setting controls how long it wait for acquiring the lock in seconds.
If the lock cannot be taken even after the duration, pg_reorg forces to cancel conflicted queries.
Also, if the server version is 8.4 or newer, pg_reorg forces to disconnect conflicted backends after twice time passed.
If the lock cannot be taken even after the duration, pg_repack forces to cancel conflicted queries.
Also, if the server version is 8.4 or newer, pg_repack forces to disconnect conflicted backends after twice time passed.
The default is 60 seconds.
</dd>
@ -171,7 +171,7 @@ This option can be useful in batch jobs and scripts where no user is present to
<dt>-W<br>
--password</dt>
<dd>Force the program to prompt for a password before connecting to a database.</dd>
<dd>This option is never essential, since the program will automatically prompt for a password if the server demands password authentication. However, pg_reorg will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. </dd>
<dd>This option is never essential, since the program will automatically prompt for a password if the server demands password authentication. However, pg_repack will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. </dd>
</dl>
<h3>Generic Options</h3>
@ -200,19 +200,19 @@ The default is INFO.</dd>
<p>This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see <a href="http://developer.postgresql.org/pgdocs/postgres/libpq-envars.html">Environment Variables</a>).</p>
<h2 id="diagnostics">Diagnostics</h2>
<p>Error messages are reported when pg_reorg fails.
<p>Error messages are reported when pg_repack fails.
The following list shows the cause of errors.</p>
<p>You need to cleanup by hand after fatal errors.
To cleanup, execute $PGHOME/share/contrib/uninstall_pg_reorg.sql to the database where the error occured and then execute $PGHOME/share/contrib/pg_reorg.sql. (Do uninstall and reinstall.)</p>
To cleanup, execute $PGHOME/share/contrib/uninstall_pg_repack.sql to the database where the error occured and then execute $PGHOME/share/contrib/pg_repack.sql. (Do uninstall and reinstall.)</p>
<dl>
<dt>pg_reorg : reorg database "template1" ... skipped</dt>
<dd>pg_reorg is not installed in the database when --all option is specified.</dd>
<dd>Do register pg_reorg to the database.</dd>
<dt>pg_repack : repack database "template1" ... skipped</dt>
<dd>pg_repack is not installed in the database when --all option is specified.</dd>
<dd>Do register pg_repack to the database.</dd>
<dt>ERROR: pg_reorg is not installed</dt>
<dd>pg_reorg is not installed in the database specified by --dbname.</dd>
<dd>Do register pg_reorg to the database.</dd>
<dt>ERROR: pg_repack is not installed</dt>
<dd>pg_repack is not installed in the database specified by --dbname.</dd>
<dd>Do register pg_repack to the database.</dd>
<dt>ERROR: relation "table" has no primary key</dt>
<dd>The target table doesn't have PRIMARY KEY.</dd>
@ -222,40 +222,40 @@ To cleanup, execute $PGHOME/share/contrib/uninstall_pg_reorg.sql to the database
<dd>The target table doesn't have CLUSTER KEY.</dd>
<dd>Define CLUSTER KEY to the table. (ALTER TABLE CLUSTER)</dd>
<dt>pg_reorg : query failed: ERROR: column "col" does not exist</dt>
<dt>pg_repack : query failed: ERROR: column "col" does not exist</dt>
<dd>The target table doesn't have columns specified by --order-by option.</dd>
<dd>Specify existing columns.</dd>
<dt>ERROR: permission denied for schema reorg</dt>
<dt>ERROR: permission denied for schema repack</dt>
<dd>Permission error.</dd>
<dd>pg_reorg must be executed by superusers.</dd>
<dd>pg_repack must be executed by superusers.</dd>
<dt>pg_reorg : query failed: ERROR: trigger "z_reorg_trigger" for relation "tbl" already exists</dt>
<dd>The target table already has a trigger named "z_reorg_trigger".</dd>
<dt>pg_repack : query failed: ERROR: trigger "z_repack_trigger" for relation "tbl" already exists</dt>
<dd>The target table already has a trigger named "z_repack_trigger".</dd>
<dd>Delete or rename the trigger.</dd>
<dt>pg_reorg : trigger conflicted for tbl</dt>
<dd>The target table already has a trigger which follows by "z_reorg_trigger" in alphabetical order.</dd>
<dt>pg_repack : trigger conflicted for tbl</dt>
<dd>The target table already has a trigger which follows by "z_repack_trigger" in alphabetical order.</dd>
<dd>Delete or rename the trigger.</dd>
</dl>
<h2 id="restrictions">Restrictions</h2>
<p>pg_reorg has the following restrictions.
<p>pg_repack has the following restrictions.
Be careful to avoid data corruptions.</p>
<h3>Temp tables</h3>
<p>pg_reorg cannot reorganize temp tables.</p>
<p>pg_repack cannot reorganize temp tables.</p>
<h3>GiST indexes</h3>
<p>pg_reorg cannot reorganize tables using GiST indexes.</p>
<p>pg_repack cannot reorganize tables using GiST indexes.</p>
<h3>DDL commands</h3>
<p>You cannot do DDL commands <strong>except</strong> VACUUM and ANALYZE during pg_reorg.
In many cases pg_reorg will fail and rollback collectly, but there are some cases which may result in data-corruption .</p>
<p>You cannot do DDL commands <strong>except</strong> VACUUM and ANALYZE during pg_repack.
In many cases pg_repack will fail and rollback collectly, but there are some cases which may result in data-corruption .</p>
<dl>
<dt>TRUNCATE</dt>
<dd>TRUNCATE is lost. Deleted rows still exist after pg_reorg.</dd>
<dd>TRUNCATE is lost. Deleted rows still exist after pg_repack.</dd>
<dt>CREATE INDEX</dt>
<dd>It causes index corruptions.</dd>
@ -271,17 +271,17 @@ In many cases pg_reorg will fail and rollback collectly, but there are some case
</dl>
<h2 id="details">Details</h2>
<p>pg_reorg creates a work table in the reorg schema and sorts the rows in this table.
<p>pg_repack creates a work table in the repack schema and sorts the rows in this table.
Then, it updates the system catalogs directly to swap the work table and the original one.</p>
<h2 id="install">Installations</h2>
<p>
pg_reorg can be built with "make" on UNIX or Linux.
pg_repack can be built with "make" on UNIX or Linux.
pgxs build framework is used automatically.
Before building, you might need to install postgres packages for developer (postgresql-devel, etc.)
and add <code>pg_config</code> to your $PATH.
</p>
<pre>$ cd pg_reorg
<pre>$ cd pg_repack
$ make
$ su
$ make install</pre>
@ -292,7 +292,7 @@ There are project files in the msvc folder.
<p>Start PostgreSQL and execute the script to register functions to your database.</p>
<pre>$ pg_ctl start
$ psql -f $PGSHARE/contrib/pg_reorg.sql -d your_database</pre>
$ psql -f $PGSHARE/contrib/pg_repack.sql -d your_database</pre>
<p>(NOTE: <code>CREATE EXTENSION</code> is not supported yet.)</p>
@ -322,7 +322,7 @@ required.</dd>
<hr>
<div class="navigation">
<a href="index.html">Top</a> &gt;
<a href="pg_reorg.html">pg_reorg</a>
<a href="pg_repack.html">pg_repack</a>
</div>
<div>

4
lib/.gitignore vendored
View File

@ -1,3 +1,3 @@
/.deps/
/pg_reorg.sql
/pg_reorg--[0-9.]*.sql
/pg_repack.sql
/pg_repack--[0-9.]*.sql

View File

@ -1,13 +1,13 @@
#
# pg_reorg: lib/Makefile
# pg_repack: lib/Makefile
#
# Portions Copyright (c) 2008-2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
# Portions Copyright (c) 2011, Itagaki Takahiro
#
MODULE_big = pg_reorg
OBJS = reorg.o pgut/pgut-be.o pgut/pgut-spi.o
MODULE_big = pg_repack
OBJS = repack.o pgut/pgut-be.o pgut/pgut-spi.o
EXTENSION = pg_reorg
EXTENSION = pg_repack
# The version of the extension, read from the .control file.
# Note that it doesn't need to be the same of the library version: it should
@ -16,8 +16,8 @@ EXTVER = $(shell grep -e '^default_version' $(EXTENSION).control \
| sed -e "s/[^']*'\([^']*\)'.*/\1/")
#supports both EXTENSION (for >=9.1) and without_EXTENSION (for <PG 9.1)
DATA_built = pg_reorg.sql pg_reorg--$(EXTVER).sql
DATA = pg_reorg--1.1.7--1.1.8.sql uninstall_pg_reorg.sql
DATA_built = pg_repack.sql pg_repack--$(EXTVER).sql
DATA = pg_repack--1.1.7--1.1.8.sql uninstall_pg_repack.sql
ifndef USE_PGXS
top_builddir = ../../..
@ -41,12 +41,12 @@ endif
LIBS := $(filter-out -lxml2, $(LIBS))
LIBS := $(filter-out -lxslt, $(LIBS))
pg_reorg.sql: pg_reorg.sql.in
pg_repack.sql: pg_repack.sql.in
echo "BEGIN;\n" > $@; \
echo "CREATE SCHEMA reorg;\n" >> $@; \
echo "CREATE SCHEMA repack;\n" >> $@; \
sed 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' $< >> $@; \
echo "\nCOMMIT;" >> $@;
pg_reorg--$(EXTVER).sql: pg_reorg.sql.in
echo '\echo Use "CREATE EXTENSION pg_reorg" to load this file. \quit' > $@; \
pg_repack--$(EXTVER).sql: pg_repack.sql.in
echo '\echo Use "CREATE EXTENSION pg_repack" to load this file. \quit' > $@; \
cat $< >> $@;

View File

@ -1,25 +0,0 @@
/* Create the pg_reorg extension from a loose set of objects */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pg_reorg FROM 1.1.7" to load this file. \quit
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.version();
ALTER EXTENSION pg_reorg ADD AGGREGATE reorg.array_accum(anyelement);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.oid2text(oid);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_index_columns(oid, text);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_index_keys(oid, oid);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_create_index_type(oid, name);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_create_trigger(relid oid, pkid oid);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_assign(oid, text);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_compare_pkey(oid, text);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_columns_for_create_as(oid);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.get_drop_columns(oid, text);
ALTER EXTENSION pg_reorg ADD VIEW reorg.primary_keys;
ALTER EXTENSION pg_reorg ADD VIEW reorg.tables;
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.reorg_indexdef(oid, oid);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.reorg_trigger();
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.conflicted_triggers(oid);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.disable_autovacuum(regclass);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.reorg_apply(cstring,cstring,cstring,cstring,cstring,integer);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.reorg_swap(oid);
ALTER EXTENSION pg_reorg ADD FUNCTION reorg.reorg_drop(oid);

View File

@ -0,0 +1,25 @@
/* Create the pg_repack extension from a loose set of objects */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pg_repack FROM 1.1.7" to load this file. \quit
ALTER EXTENSION pg_repack ADD FUNCTION repack.version();
ALTER EXTENSION pg_repack ADD AGGREGATE repack.array_accum(anyelement);
ALTER EXTENSION pg_repack ADD FUNCTION repack.oid2text(oid);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_index_columns(oid, text);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_index_keys(oid, oid);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_create_index_type(oid, name);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_create_trigger(relid oid, pkid oid);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_assign(oid, text);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_compare_pkey(oid, text);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_columns_for_create_as(oid);
ALTER EXTENSION pg_repack ADD FUNCTION repack.get_drop_columns(oid, text);
ALTER EXTENSION pg_repack ADD VIEW repack.primary_keys;
ALTER EXTENSION pg_repack ADD VIEW repack.tables;
ALTER EXTENSION pg_repack ADD FUNCTION repack.repack_indexdef(oid, oid);
ALTER EXTENSION pg_repack ADD FUNCTION repack.repack_trigger();
ALTER EXTENSION pg_repack ADD FUNCTION repack.conflicted_triggers(oid);
ALTER EXTENSION pg_repack ADD FUNCTION repack.disable_autovacuum(regclass);
ALTER EXTENSION pg_repack ADD FUNCTION repack.repack_apply(cstring,cstring,cstring,cstring,cstring,integer);
ALTER EXTENSION pg_repack ADD FUNCTION repack.repack_swap(oid);
ALTER EXTENSION pg_repack ADD FUNCTION repack.repack_drop(oid);

View File

@ -1,6 +1,6 @@
# pg_reorg extension
# pg_repack extension
comment = 're-organizes a PostgreSQL database'
default_version = '1.2dev0'
module_pathname = '$libdir/pg_reorg'
module_pathname = '$libdir/pg_repack'
relocatable = false
schema = reorg
schema = repack

View File

@ -1,30 +1,30 @@
/*
* pg_reorg: lib/pg_reorg.sql.in
* pg_repack: lib/pg_repack.sql.in
*
* Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
* Portions Copyright (c) 2011, Itagaki Takahiro
*/
CREATE FUNCTION reorg.version() RETURNS text AS
'MODULE_PATHNAME', 'reorg_version'
CREATE FUNCTION repack.version() RETURNS text AS
'MODULE_PATHNAME', 'repack_version'
LANGUAGE C IMMUTABLE STRICT;
CREATE AGGREGATE reorg.array_accum (
CREATE AGGREGATE repack.array_accum (
sfunc = array_append,
basetype = anyelement,
stype = anyarray,
initcond = '{}'
);
CREATE FUNCTION reorg.oid2text(oid) RETURNS text AS
CREATE FUNCTION repack.oid2text(oid) RETURNS text AS
$$
SELECT textin(regclassout($1));
$$
LANGUAGE sql STABLE STRICT;
CREATE FUNCTION reorg.get_index_columns(oid, text) RETURNS text AS
CREATE FUNCTION repack.get_index_columns(oid, text) RETURNS text AS
$$
SELECT array_to_string(reorg.array_accum(quote_ident(attname)), $2)
SELECT array_to_string(repack.array_accum(quote_ident(attname)), $2)
FROM pg_attribute,
(SELECT indrelid,
indkey,
@ -37,14 +37,14 @@ $$
$$
LANGUAGE sql STABLE STRICT;
CREATE FUNCTION reorg.get_index_keys(oid, oid) RETURNS text AS
'MODULE_PATHNAME', 'reorg_get_index_keys'
CREATE FUNCTION repack.get_index_keys(oid, oid) RETURNS text AS
'MODULE_PATHNAME', 'repack_get_index_keys'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION reorg.get_create_index_type(oid, name) RETURNS text AS
CREATE FUNCTION repack.get_create_index_type(oid, name) RETURNS text AS
$$
SELECT 'CREATE TYPE ' || $2 || ' AS (' ||
array_to_string(reorg.array_accum(quote_ident(attname) || ' ' ||
array_to_string(repack.array_accum(quote_ident(attname) || ' ' ||
pg_catalog.format_type(atttypid, atttypmod)), ', ') || ')'
FROM pg_attribute,
(SELECT indrelid,
@ -58,44 +58,44 @@ $$
$$
LANGUAGE sql STABLE STRICT;
CREATE FUNCTION reorg.get_create_trigger(relid oid, pkid oid)
CREATE FUNCTION repack.get_create_trigger(relid oid, pkid oid)
RETURNS text AS
$$
SELECT 'CREATE TRIGGER z_reorg_trigger' ||
' BEFORE INSERT OR DELETE OR UPDATE ON ' || reorg.oid2text($1) ||
' FOR EACH ROW EXECUTE PROCEDURE reorg.reorg_trigger(' ||
'''INSERT INTO reorg.log_' || $1 || '(pk, row) VALUES(' ||
SELECT 'CREATE TRIGGER z_repack_trigger' ||
' BEFORE INSERT OR DELETE OR UPDATE ON ' || repack.oid2text($1) ||
' FOR EACH ROW EXECUTE PROCEDURE repack.repack_trigger(' ||
'''INSERT INTO repack.log_' || $1 || '(pk, row) VALUES(' ||
' CASE WHEN $1 IS NULL THEN NULL ELSE (ROW($1.' ||
reorg.get_index_columns($2, ', $1.') || ')::reorg.pk_' ||
repack.get_index_columns($2, ', $1.') || ')::repack.pk_' ||
$1 || ') END, $2)'')';
$$
LANGUAGE sql STABLE STRICT;
CREATE FUNCTION reorg.get_alter_table(relid oid)
CREATE FUNCTION repack.get_alter_table(relid oid)
RETURNS text AS
$$
SELECT 'ALTER TABLE ' || reorg.oid2text($1) ||
' ENABLE ALWAYS TRIGGER z_reorg_trigger';
SELECT 'ALTER TABLE ' || repack.oid2text($1) ||
' ENABLE ALWAYS TRIGGER z_repack_trigger';
$$
LANGUAGE sql STABLE STRICT;
CREATE FUNCTION reorg.get_assign(oid, text) RETURNS text AS
CREATE FUNCTION repack.get_assign(oid, text) RETURNS text AS
$$
SELECT '(' || array_to_string(reorg.array_accum(quote_ident(attname)), ', ') ||
SELECT '(' || array_to_string(repack.array_accum(quote_ident(attname)), ', ') ||
') = (' || $2 || '.' ||
array_to_string(reorg.array_accum(quote_ident(attname)), ', ' || $2 || '.') || ')'
array_to_string(repack.array_accum(quote_ident(attname)), ', ' || $2 || '.') || ')'
FROM (SELECT attname FROM pg_attribute
WHERE attrelid = $1 AND attnum > 0 AND NOT attisdropped
ORDER BY attnum) tmp;
$$
LANGUAGE sql STABLE STRICT;
CREATE FUNCTION reorg.get_compare_pkey(oid, text)
CREATE FUNCTION repack.get_compare_pkey(oid, text)
RETURNS text AS
$$
SELECT '(' || array_to_string(reorg.array_accum(quote_ident(attname)), ', ') ||
SELECT '(' || array_to_string(repack.array_accum(quote_ident(attname)), ', ') ||
') = (' || $2 || '.' ||
array_to_string(reorg.array_accum(quote_ident(attname)), ', ' || $2 || '.') || ')'
array_to_string(repack.array_accum(quote_ident(attname)), ', ' || $2 || '.') || ')'
FROM pg_attribute,
(SELECT indrelid,
indkey,
@ -110,10 +110,10 @@ LANGUAGE sql STABLE STRICT;
-- Get a column list for SELECT all columns including dropped ones.
-- We use NULLs of integer types for dropped columns (types are not important).
CREATE FUNCTION reorg.get_columns_for_create_as(oid)
CREATE FUNCTION repack.get_columns_for_create_as(oid)
RETURNS text AS
$$
SELECT array_to_string(reorg.array_accum(c), ',') FROM (SELECT
SELECT array_to_string(repack.array_accum(c), ',') FROM (SELECT
CASE WHEN attisdropped
THEN 'NULL::integer AS ' || quote_ident(attname)
ELSE quote_ident(attname)
@ -126,14 +126,14 @@ LANGUAGE sql STABLE STRICT;
-- Get a SQL text to DROP dropped columns for the table,
-- or NULL if it has no dropped columns.
CREATE FUNCTION reorg.get_drop_columns(oid, text)
CREATE FUNCTION repack.get_drop_columns(oid, text)
RETURNS text AS
$$
SELECT
'ALTER TABLE ' || $2 || ' ' || array_to_string(dropped_columns, ', ')
FROM (
SELECT
reorg.array_accum('DROP COLUMN ' || quote_ident(attname)) AS dropped_columns
repack.array_accum('DROP COLUMN ' || quote_ident(attname)) AS dropped_columns
FROM (
SELECT * FROM pg_attribute
WHERE attrelid = $1 AND attnum > 0 AND attisdropped
@ -146,8 +146,8 @@ $$
LANGUAGE sql STABLE STRICT;
-- includes not only PRIMARY KEYS but also UNIQUE NOT NULL keys
CREATE VIEW reorg.primary_keys AS
SELECT indrelid, (reorg.array_accum(indexrelid))[1] AS indexrelid
CREATE VIEW repack.primary_keys AS
SELECT indrelid, (repack.array_accum(indexrelid))[1] AS indexrelid
FROM (SELECT indrelid, indexrelid FROM pg_index
WHERE indisunique
AND indisvalid
@ -160,30 +160,30 @@ CREATE VIEW reorg.primary_keys AS
ORDER BY indrelid, indisprimary DESC, indnatts, indkey) tmp
GROUP BY indrelid;
CREATE VIEW reorg.tables AS
CREATE VIEW repack.tables AS
SELECT R.oid::regclass AS relname,
R.oid AS relid,
R.reltoastrelid AS reltoastrelid,
CASE WHEN R.reltoastrelid = 0 THEN 0 ELSE (SELECT reltoastidxid FROM pg_class WHERE oid = R.reltoastrelid) END AS reltoastidxid,
PK.indexrelid AS pkid,
CK.indexrelid AS ckid,
reorg.get_create_index_type(PK.indexrelid, 'reorg.pk_' || R.oid) AS create_pktype,
'CREATE TABLE reorg.log_' || R.oid || ' (id bigserial PRIMARY KEY, pk reorg.pk_' || R.oid || ', row ' || reorg.oid2text(R.oid) || ')' AS create_log,
reorg.get_create_trigger(R.oid, PK.indexrelid) AS create_trigger,
reorg.get_alter_table(R.oid) as alter_table,
'CREATE TABLE reorg.table_' || R.oid || ' WITH (' || array_to_string(array_append(R.reloptions, 'oids=' || CASE WHEN R.relhasoids THEN 'true' ELSE 'false' END), ',') || ') TABLESPACE ' || coalesce(quote_ident(S.spcname), 'pg_default') || ' AS SELECT ' || reorg.get_columns_for_create_as(R.oid) || ' FROM ONLY ' || reorg.oid2text(R.oid) AS create_table,
reorg.get_drop_columns(R.oid, 'reorg.table_' || R.oid) AS drop_columns,
'DELETE FROM reorg.log_' || R.oid AS delete_log,
'LOCK TABLE ' || reorg.oid2text(R.oid) || ' IN ACCESS EXCLUSIVE MODE' AS lock_table,
reorg.get_index_keys(CK.indexrelid, R.oid) AS ckey,
'SELECT * FROM reorg.log_' || R.oid || ' ORDER BY id LIMIT $1' AS sql_peek,
'INSERT INTO reorg.table_' || R.oid || ' VALUES ($1.*)' AS sql_insert,
'DELETE FROM reorg.table_' || R.oid || ' WHERE ' || reorg.get_compare_pkey(PK.indexrelid, '$1') AS sql_delete,
'UPDATE reorg.table_' || R.oid || ' SET ' || reorg.get_assign(R.oid, '$2') || ' WHERE ' || reorg.get_compare_pkey(PK.indexrelid, '$1') AS sql_update,
'DELETE FROM reorg.log_' || R.oid || ' WHERE id <= $1' AS sql_pop
repack.get_create_index_type(PK.indexrelid, 'repack.pk_' || R.oid) AS create_pktype,
'CREATE TABLE repack.log_' || R.oid || ' (id bigserial PRIMARY KEY, pk repack.pk_' || R.oid || ', row ' || repack.oid2text(R.oid) || ')' AS create_log,
repack.get_create_trigger(R.oid, PK.indexrelid) AS create_trigger,
repack.get_alter_table(R.oid) as alter_table,
'CREATE TABLE repack.table_' || R.oid || ' WITH (' || array_to_string(array_append(R.reloptions, 'oids=' || CASE WHEN R.relhasoids THEN 'true' ELSE 'false' END), ',') || ') TABLESPACE ' || coalesce(quote_ident(S.spcname), 'pg_default') || ' AS SELECT ' || repack.get_columns_for_create_as(R.oid) || ' FROM ONLY ' || repack.oid2text(R.oid) AS create_table,
repack.get_drop_columns(R.oid, 'repack.table_' || R.oid) AS drop_columns,
'DELETE FROM repack.log_' || R.oid AS delete_log,
'LOCK TABLE ' || repack.oid2text(R.oid) || ' IN ACCESS EXCLUSIVE MODE' AS lock_table,
repack.get_index_keys(CK.indexrelid, R.oid) AS ckey,
'SELECT * FROM repack.log_' || R.oid || ' ORDER BY id LIMIT $1' AS sql_peek,
'INSERT INTO repack.table_' || R.oid || ' VALUES ($1.*)' AS sql_insert,
'DELETE FROM repack.table_' || R.oid || ' WHERE ' || repack.get_compare_pkey(PK.indexrelid, '$1') AS sql_delete,
'UPDATE repack.table_' || R.oid || ' SET ' || repack.get_assign(R.oid, '$2') || ' WHERE ' || repack.get_compare_pkey(PK.indexrelid, '$1') AS sql_update,
'DELETE FROM repack.log_' || R.oid || ' WHERE id <= $1' AS sql_pop
FROM pg_class R
LEFT JOIN pg_class T ON R.reltoastrelid = T.oid
LEFT JOIN reorg.primary_keys PK
LEFT JOIN repack.primary_keys PK
ON R.oid = PK.indrelid
LEFT JOIN (SELECT CKI.* FROM pg_index CKI, pg_class CKT
WHERE CKI.indisvalid
@ -197,26 +197,26 @@ CREATE VIEW reorg.tables AS
AND N.nspname NOT IN ('pg_catalog', 'information_schema')
AND N.nspname NOT LIKE E'pg\\_temp\\_%';
CREATE FUNCTION reorg.reorg_indexdef(oid, oid) RETURNS text AS
'MODULE_PATHNAME', 'reorg_indexdef'
CREATE FUNCTION repack.repack_indexdef(oid, oid) RETURNS text AS
'MODULE_PATHNAME', 'repack_indexdef'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION reorg.reorg_trigger() RETURNS trigger AS
'MODULE_PATHNAME', 'reorg_trigger'
CREATE FUNCTION repack.repack_trigger() RETURNS trigger AS
'MODULE_PATHNAME', 'repack_trigger'
LANGUAGE C VOLATILE STRICT SECURITY DEFINER;
CREATE FUNCTION reorg.conflicted_triggers(oid) RETURNS SETOF name AS
CREATE FUNCTION repack.conflicted_triggers(oid) RETURNS SETOF name AS
$$
SELECT tgname FROM pg_trigger
WHERE tgrelid = $1 AND tgname >= 'z_reorg_trigger'
WHERE tgrelid = $1 AND tgname >= 'z_repack_trigger'
$$
LANGUAGE sql STABLE STRICT;
CREATE FUNCTION reorg.disable_autovacuum(regclass) RETURNS void AS
'MODULE_PATHNAME', 'reorg_disable_autovacuum'
CREATE FUNCTION repack.disable_autovacuum(regclass) RETURNS void AS
'MODULE_PATHNAME', 'repack_disable_autovacuum'
LANGUAGE C VOLATILE STRICT;
CREATE FUNCTION reorg.reorg_apply(
CREATE FUNCTION repack.repack_apply(
sql_peek cstring,
sql_insert cstring,
sql_delete cstring,
@ -224,13 +224,13 @@ CREATE FUNCTION reorg.reorg_apply(
sql_pop cstring,
count integer)
RETURNS integer AS
'MODULE_PATHNAME', 'reorg_apply'
'MODULE_PATHNAME', 'repack_apply'
LANGUAGE C VOLATILE;
CREATE FUNCTION reorg.reorg_swap(oid) RETURNS void AS
'MODULE_PATHNAME', 'reorg_swap'
CREATE FUNCTION repack.repack_swap(oid) RETURNS void AS
'MODULE_PATHNAME', 'repack_swap'
LANGUAGE C VOLATILE STRICT;
CREATE FUNCTION reorg.reorg_drop(oid) RETURNS void AS
'MODULE_PATHNAME', 'reorg_drop'
CREATE FUNCTION repack.repack_drop(oid) RETURNS void AS
'MODULE_PATHNAME', 'repack_drop'
LANGUAGE C VOLATILE STRICT;

View File

@ -1,5 +1,5 @@
/*
* pg_reorg: lib/reorg.c
* pg_repack: lib/repack.c
*
* Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
* Portions Copyright (c) 2011, Itagaki Takahiro
@ -37,26 +37,26 @@
PG_MODULE_MAGIC;
extern Datum PGUT_EXPORT reorg_version(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT reorg_trigger(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT reorg_apply(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT reorg_get_index_keys(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT reorg_indexdef(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT reorg_swap(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT reorg_drop(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT reorg_disable_autovacuum(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_version(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_trigger(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_apply(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_get_index_keys(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_indexdef(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_swap(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_drop(PG_FUNCTION_ARGS);
extern Datum PGUT_EXPORT repack_disable_autovacuum(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(reorg_version);
PG_FUNCTION_INFO_V1(reorg_trigger);
PG_FUNCTION_INFO_V1(reorg_apply);
PG_FUNCTION_INFO_V1(reorg_get_index_keys);
PG_FUNCTION_INFO_V1(reorg_indexdef);
PG_FUNCTION_INFO_V1(reorg_swap);
PG_FUNCTION_INFO_V1(reorg_drop);
PG_FUNCTION_INFO_V1(reorg_disable_autovacuum);
PG_FUNCTION_INFO_V1(repack_version);
PG_FUNCTION_INFO_V1(repack_trigger);
PG_FUNCTION_INFO_V1(repack_apply);
PG_FUNCTION_INFO_V1(repack_get_index_keys);
PG_FUNCTION_INFO_V1(repack_indexdef);
PG_FUNCTION_INFO_V1(repack_swap);
PG_FUNCTION_INFO_V1(repack_drop);
PG_FUNCTION_INFO_V1(repack_disable_autovacuum);
static void reorg_init(void);
static SPIPlanPtr reorg_prepare(const char *src, int nargs, Oid *argtypes);
static void repack_init(void);
static SPIPlanPtr repack_prepare(const char *src, int nargs, Oid *argtypes);
static const char *get_quoted_relname(Oid oid);
static const char *get_quoted_nspname(Oid oid);
static void swap_heap_or_index_files(Oid r1, Oid r2);
@ -95,21 +95,21 @@ static void RenameRelationInternal(Oid myrelid, const char *newrelname, Oid name
Datum
reorg_version(PG_FUNCTION_ARGS)
repack_version(PG_FUNCTION_ARGS)
{
return CStringGetTextDatum("pg_reorg 1.1.6");
return CStringGetTextDatum("pg_repack 1.1.6");
}
/**
* @fn Datum reorg_trigger(PG_FUNCTION_ARGS)
* @fn Datum repack_trigger(PG_FUNCTION_ARGS)
* @brief Insert a operation log into log-table.
*
* reorg_trigger(sql)
* repack_trigger(sql)
*
* @param sql SQL to insert a operation log into log-table.
*/
Datum
reorg_trigger(PG_FUNCTION_ARGS)
repack_trigger(PG_FUNCTION_ARGS)
{
TriggerData *trigdata = (TriggerData *) fcinfo->context;
TupleDesc desc;
@ -120,14 +120,14 @@ reorg_trigger(PG_FUNCTION_ARGS)
const char *sql;
/* authority check */
must_be_superuser("reorg_trigger");
must_be_superuser("repack_trigger");
/* make sure it's called as a trigger at all */
if (!CALLED_AS_TRIGGER(fcinfo) ||
!TRIGGER_FIRED_BEFORE(trigdata->tg_event) ||
!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event) ||
trigdata->tg_trigger->tgnargs != 1)
elog(ERROR, "reorg_trigger: invalid trigger call");
elog(ERROR, "repack_trigger: invalid trigger call");
/* retrieve parameters */
sql = trigdata->tg_trigger->tgargs[0];
@ -135,7 +135,7 @@ reorg_trigger(PG_FUNCTION_ARGS)
argtypes[0] = argtypes[1] = trigdata->tg_relation->rd_rel->reltype;
/* connect to SPI manager */
reorg_init();
repack_init();
if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
{
@ -159,7 +159,7 @@ reorg_trigger(PG_FUNCTION_ARGS)
values[1] = copy_tuple(tuple, desc);
}
/* INSERT INTO reorg.log VALUES ($1, $2) */
/* INSERT INTO repack.log VALUES ($1, $2) */
execute_with_args(SPI_OK_INSERT, sql, 2, argtypes, values, nulls);
SPI_finish();
@ -168,10 +168,10 @@ reorg_trigger(PG_FUNCTION_ARGS)
}
/**
* @fn Datum reorg_apply(PG_FUNCTION_ARGS)
* @fn Datum repack_apply(PG_FUNCTION_ARGS)
* @brief Apply operations in log table into temp table.
*
* reorg_apply(sql_peek, sql_insert, sql_delete, sql_update, sql_pop, count)
* repack_apply(sql_peek, sql_insert, sql_delete, sql_update, sql_pop, count)
*
* @param sql_peek SQL to pop tuple from log table.
* @param sql_insert SQL to insert into temp table.
@ -182,7 +182,7 @@ reorg_trigger(PG_FUNCTION_ARGS)
* @retval Number of performed operations.
*/
Datum
reorg_apply(PG_FUNCTION_ARGS)
repack_apply(PG_FUNCTION_ARGS)
{
#define DEFAULT_PEEK_COUNT 1000
@ -204,13 +204,13 @@ reorg_apply(PG_FUNCTION_ARGS)
bool nulls_peek[1] = { 0 };
/* authority check */
must_be_superuser("reorg_apply");
must_be_superuser("repack_apply");
/* connect to SPI manager */
reorg_init();
repack_init();
/* peek tuple in log */
plan_peek = reorg_prepare(sql_peek, 1, argtypes_peek);
plan_peek = repack_prepare(sql_peek, 1, argtypes_peek);
for (n = 0;;)
{
@ -252,28 +252,28 @@ reorg_apply(PG_FUNCTION_ARGS)
{
/* INSERT */
if (plan_insert == NULL)
plan_insert = reorg_prepare(sql_insert, 1, &argtypes[2]);
plan_insert = repack_prepare(sql_insert, 1, &argtypes[2]);
execute_plan(SPI_OK_INSERT, plan_insert, &values[2], &nulls[2]);
}
else if (nulls[2])
{
/* DELETE */
if (plan_delete == NULL)
plan_delete = reorg_prepare(sql_delete, 1, &argtypes[1]);
plan_delete = repack_prepare(sql_delete, 1, &argtypes[1]);
execute_plan(SPI_OK_DELETE, plan_delete, &values[1], &nulls[1]);
}
else
{
/* UPDATE */
if (plan_update == NULL)
plan_update = reorg_prepare(sql_update, 2, &argtypes[1]);
plan_update = repack_prepare(sql_update, 2, &argtypes[1]);
execute_plan(SPI_OK_UPDATE, plan_update, &values[1], &nulls[1]);
}
}
/* delete tuple in log */
if (plan_pop == NULL)
plan_pop = reorg_prepare(sql_pop, 1, argtypes);
plan_pop = repack_prepare(sql_pop, 1, argtypes);
execute_plan(SPI_OK_DELETE, plan_pop, values, nulls);
SPI_freetuptable(tuptable);
@ -464,10 +464,10 @@ parse_indexdef(IndexDef *stmt, Oid index, Oid table)
}
/**
* @fn Datum reorg_get_index_keys(PG_FUNCTION_ARGS)
* @fn Datum repack_get_index_keys(PG_FUNCTION_ARGS)
* @brief Get key definition of the index.
*
* reorg_get_index_keys(index, table)
* repack_get_index_keys(index, table)
*
* @param index Oid of target index.
* @param table Oid of table of the index.
@ -477,7 +477,7 @@ parse_indexdef(IndexDef *stmt, Oid index, Oid table)
* an expression for ORDER BY clause. get_order_by() might be a better name.
*/
Datum
reorg_get_index_keys(PG_FUNCTION_ARGS)
repack_get_index_keys(PG_FUNCTION_ARGS)
{
Oid index = PG_GETARG_OID(0);
Oid table = PG_GETARG_OID(1);
@ -564,17 +564,17 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
}
/**
* @fn Datum reorg_indexdef(PG_FUNCTION_ARGS)
* @fn Datum repack_indexdef(PG_FUNCTION_ARGS)
* @brief Reproduce DDL that create index at the temp table.
*
* reorg_indexdef(index, table)
* repack_indexdef(index, table)
*
* @param index Oid of target index.
* @param table Oid of table of the index.
* @retval Create index DDL for temp table.
*/
Datum
reorg_indexdef(PG_FUNCTION_ARGS)
repack_indexdef(PG_FUNCTION_ARGS)
{
Oid index = PG_GETARG_OID(0);
Oid table = PG_GETARG_OID(1);
@ -583,7 +583,7 @@ reorg_indexdef(PG_FUNCTION_ARGS)
parse_indexdef(&stmt, index, table);
initStringInfo(&str);
appendStringInfo(&str, "%s index_%u ON reorg.table_%u USING %s (%s)%s",
appendStringInfo(&str, "%s index_%u ON repack.table_%u USING %s (%s)%s",
stmt.create, index, table, stmt.type, stmt.columns, stmt.options);
PG_RETURN_TEXT_P(cstring_to_text(str.data));
@ -598,11 +598,11 @@ getoid(HeapTuple tuple, TupleDesc desc, int column)
}
/**
* @fn Datum reorg_swap(PG_FUNCTION_ARGS)
* @fn Datum repack_swap(PG_FUNCTION_ARGS)
* @brief Swapping relfilenode of tables and relation ids of toast tables
* and toast indexes.
*
* reorg_swap(oid, relname)
* repack_swap(oid, relname)
*
* TODO: remove useless CommandCounterIncrement().
*
@ -610,7 +610,7 @@ getoid(HeapTuple tuple, TupleDesc desc, int column)
* @retval None.
*/
Datum
reorg_swap(PG_FUNCTION_ARGS)
repack_swap(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
const char *relname = get_quoted_relname(oid);
@ -633,10 +633,10 @@ reorg_swap(PG_FUNCTION_ARGS)
Oid owner2;
/* authority check */
must_be_superuser("reorg_swap");
must_be_superuser("repack_swap");
/* connect to SPI manager */
reorg_init();
repack_init();
/* swap relfilenode and dependencies for tables. */
values[0] = ObjectIdGetDatum(oid);
@ -648,7 +648,7 @@ reorg_swap(PG_FUNCTION_ARGS)
" pg_catalog.pg_class Y LEFT JOIN pg_catalog.pg_class TY"
" ON Y.reltoastrelid = TY.oid"
" WHERE X.oid = $1"
" AND Y.oid = ('reorg.table_' || X.oid)::regclass",
" AND Y.oid = ('repack.table_' || X.oid)::regclass",
1, argtypes, values, nulls);
tuptable = SPI_tuptable;
@ -656,7 +656,7 @@ reorg_swap(PG_FUNCTION_ARGS)
records = SPI_processed;
if (records == 0)
elog(ERROR, "reorg_swap : no swap target");
elog(ERROR, "repack_swap : no swap target");
tuple = tuptable->vals[0];
@ -689,7 +689,7 @@ reorg_swap(PG_FUNCTION_ARGS)
" WHERE I.indrelid = $1"
" AND I.indexrelid = X.oid"
" AND I.indisvalid"
" AND Y.oid = ('reorg.index_' || X.oid)::regclass",
" AND Y.oid = ('repack.index_' || X.oid)::regclass",
1, argtypes, values, nulls);
tuptable = SPI_tuptable;
@ -714,7 +714,7 @@ reorg_swap(PG_FUNCTION_ARGS)
if (reltoastidxid1 != InvalidOid ||
reltoastrelid2 != InvalidOid ||
reltoastidxid2 != InvalidOid)
elog(ERROR, "reorg_swap : unexpected toast relations (T1=%u, I1=%u, T2=%u, I2=%u",
elog(ERROR, "repack_swap : unexpected toast relations (T1=%u, I1=%u, T2=%u, I2=%u",
reltoastrelid1, reltoastidxid1, reltoastrelid2, reltoastidxid2);
/* do nothing */
}
@ -724,7 +724,7 @@ reorg_swap(PG_FUNCTION_ARGS)
if (reltoastidxid1 == InvalidOid ||
reltoastidxid2 != InvalidOid)
elog(ERROR, "reorg_swap : unexpected toast relations (T1=%u, I1=%u, T2=%u, I2=%u",
elog(ERROR, "repack_swap : unexpected toast relations (T1=%u, I1=%u, T2=%u, I2=%u",
reltoastrelid1, reltoastidxid1, reltoastrelid2, reltoastidxid2);
/* rename X to Y */
@ -761,10 +761,10 @@ reorg_swap(PG_FUNCTION_ARGS)
CommandCounterIncrement();
}
/* drop reorg trigger */
/* drop repack trigger */
execute_with_format(
SPI_OK_UTILITY,
"DROP TRIGGER IF EXISTS z_reorg_trigger ON %s.%s CASCADE",
"DROP TRIGGER IF EXISTS z_repack_trigger ON %s.%s CASCADE",
nspname, relname);
SPI_finish();
@ -773,34 +773,34 @@ reorg_swap(PG_FUNCTION_ARGS)
}
/**
* @fn Datum reorg_drop(PG_FUNCTION_ARGS)
* @fn Datum repack_drop(PG_FUNCTION_ARGS)
* @brief Delete temporarily objects.
*
* reorg_drop(oid, relname)
* repack_drop(oid, relname)
*
* @param oid Oid of target table.
* @retval None.
*/
Datum
reorg_drop(PG_FUNCTION_ARGS)
repack_drop(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
const char *relname = get_quoted_relname(oid);
const char *nspname = get_quoted_nspname(oid);
/* authority check */
must_be_superuser("reorg_drop");
must_be_superuser("repack_drop");
/* connect to SPI manager */
reorg_init();
repack_init();
/*
* drop reorg trigger: We have already dropped the trigger in normal
* drop repack trigger: We have already dropped the trigger in normal
* cases, but it can be left on error.
*/
execute_with_format(
SPI_OK_UTILITY,
"DROP TRIGGER IF EXISTS z_reorg_trigger ON %s.%s CASCADE",
"DROP TRIGGER IF EXISTS z_repack_trigger ON %s.%s CASCADE",
nspname, relname);
#if PG_VERSION_NUM < 80400
@ -810,7 +810,7 @@ reorg_drop(PG_FUNCTION_ARGS)
"DELETE FROM pg_catalog.pg_autovacuum v"
" USING pg_class c, pg_namespace n"
" WHERE relname IN ('log_%u', 'table_%u')"
" AND n.nspname = 'reorg'"
" AND n.nspname = 'repack'"
" AND c.relnamespace = n.oid"
" AND v.vacrelid = c.oid",
oid, oid);
@ -819,19 +819,19 @@ reorg_drop(PG_FUNCTION_ARGS)
/* drop log table */
execute_with_format(
SPI_OK_UTILITY,
"DROP TABLE IF EXISTS reorg.log_%u CASCADE",
"DROP TABLE IF EXISTS repack.log_%u CASCADE",
oid);
/* drop temp table */
execute_with_format(
SPI_OK_UTILITY,
"DROP TABLE IF EXISTS reorg.table_%u CASCADE",
"DROP TABLE IF EXISTS repack.table_%u CASCADE",
oid);
/* drop type for log table */
execute_with_format(
SPI_OK_UTILITY,
"DROP TYPE IF EXISTS reorg.pk_%u CASCADE",
"DROP TYPE IF EXISTS repack.pk_%u CASCADE",
oid);
SPI_finish();
@ -840,12 +840,12 @@ reorg_drop(PG_FUNCTION_ARGS)
}
Datum
reorg_disable_autovacuum(PG_FUNCTION_ARGS)
repack_disable_autovacuum(PG_FUNCTION_ARGS)
{
Oid oid = PG_GETARG_OID(0);
/* connect to SPI manager */
reorg_init();
repack_init();
#if PG_VERSION_NUM >= 80400
execute_with_format(
@ -866,20 +866,20 @@ reorg_disable_autovacuum(PG_FUNCTION_ARGS)
/* init SPI */
static void
reorg_init(void)
repack_init(void)
{
int ret = SPI_connect();
if (ret != SPI_OK_CONNECT)
elog(ERROR, "pg_reorg: SPI_connect returned %d", ret);
elog(ERROR, "pg_repack: SPI_connect returned %d", ret);
}
/* prepare plan */
static SPIPlanPtr
reorg_prepare(const char *src, int nargs, Oid *argtypes)
repack_prepare(const char *src, int nargs, Oid *argtypes)
{
SPIPlanPtr plan = SPI_prepare(src, nargs, argtypes);
if (plan == NULL)
elog(ERROR, "pg_reorg: reorg_prepare failed (code=%d, query=%s)", SPI_result, src);
elog(ERROR, "pg_repack: repack_prepare failed (code=%d, query=%s)", SPI_result, src);
return plan;
}

View File

@ -1,8 +1,8 @@
/*
* pg_reorg: lib/uninstall_reorg.sql
* pg_repack: lib/uninstall_repack.sql
*
* Portions Copyright (c) 2008-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
* Portions Copyright (c) 2011, Itagaki Takahiro
*/
DROP SCHEMA IF EXISTS reorg CASCADE;
DROP SCHEMA IF EXISTS repack CASCADE;

View File

@ -122,12 +122,12 @@
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='8.4|x64'">C:\Program Files %28x86%29\PostgreSQL\8.4\lib;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='8.3|Win32'">C:\Program Files %28x86%29\PostgreSQL\8.3\lib;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='8.3|x64'">C:\Program Files %28x86%29\PostgreSQL\8.4\lib;$(LibraryPath)</LibraryPath>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|Win32'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|x64'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|Win32'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|x64'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|Win32'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|x64'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|Win32'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|x64'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|Win32'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|x64'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|Win32'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|x64'">pg_repack</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='9.0|Win32'">
<ClCompile>
@ -308,15 +308,15 @@
</ItemDefinitionGroup>
<ItemGroup>
<None Include="..\bin\expected\init.out" />
<None Include="..\bin\expected\reorg.out" />
<None Include="..\bin\expected\repack.out" />
<None Include="..\bin\Makefile" />
<None Include="..\bin\sql\init.sql" />
<None Include="..\bin\sql\reorg.sql" />
<None Include="..\bin\sql\repack.sql" />
<None Include="..\COPYRIGHT" />
<None Include="..\doc\index-ja.html" />
<None Include="..\doc\index.html" />
<None Include="..\doc\pg_reorg-ja.html" />
<None Include="..\doc\pg_reorg.html" />
<None Include="..\doc\pg_repack-ja.html" />
<None Include="..\doc\pg_repack.html" />
<None Include="..\doc\style.css" />
<None Include="..\Makefile" />
<None Include="readme.txt" />
@ -324,7 +324,7 @@
<ItemGroup>
<ClCompile Include="..\bin\pgut\pgut-fe.c" />
<ClCompile Include="..\bin\pgut\pgut.c" />
<ClCompile Include="..\bin\pg_reorg.c" />
<ClCompile Include="..\bin\pg_repack.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\bin\pgut\pgut-fe.h" />

View File

@ -32,10 +32,10 @@
<None Include="..\doc\index-ja.html">
<Filter>doc</Filter>
</None>
<None Include="..\doc\pg_reorg.html">
<None Include="..\doc\pg_repack.html">
<Filter>doc</Filter>
</None>
<None Include="..\doc\pg_reorg-ja.html">
<None Include="..\doc\pg_repack-ja.html">
<Filter>doc</Filter>
</None>
<None Include="..\doc\style.css">
@ -45,13 +45,13 @@
<None Include="..\bin\expected\init.out">
<Filter>regress\expected</Filter>
</None>
<None Include="..\bin\expected\reorg.out">
<None Include="..\bin\expected\repack.out">
<Filter>regress\expected</Filter>
</None>
<None Include="..\bin\sql\init.sql">
<Filter>regress\sql</Filter>
</None>
<None Include="..\bin\sql\reorg.sql">
<None Include="..\bin\sql\repack.sql">
<Filter>regress\sql</Filter>
</None>
<None Include="..\COPYRIGHT">
@ -60,7 +60,7 @@
<None Include="..\Makefile" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\bin\pg_reorg.c">
<ClCompile Include="..\bin\pg_repack.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\bin\pgut\pgut.c">

View File

@ -107,7 +107,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\bin\pg_reorg.c"
RelativePath="..\bin\pg_repack.c"
>
</File>
<File
@ -145,11 +145,11 @@
>
</File>
<File
RelativePath="..\bin\expected\reorg.out"
RelativePath="..\bin\expected\repack.out"
>
</File>
<File
RelativePath="..\bin\sql\reorg.sql"
RelativePath="..\bin\sql\repack.sql"
>
</File>
</Filter>

View File

@ -28,13 +28,13 @@
</ItemGroup>
<ItemGroup>
<None Include="..\lib\Makefile" />
<None Include="..\lib\pg_reorg.sql.in" />
<None Include="..\lib\uninstall_pg_reorg.sql" />
<None Include="..\lib\pg_repack.sql.in" />
<None Include="..\lib\uninstall_pg_repack.sql" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\lib\pgut\pgut-be.c" />
<ClCompile Include="..\lib\pgut\pgut-spi.c" />
<ClCompile Include="..\lib\reorg.c" />
<ClCompile Include="..\lib\repack.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\lib\pgut\pgut-be.h" />
@ -136,12 +136,12 @@
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='8.4|x64'">C:\Program Files %28x86%29\PostgreSQL\8.4\lib;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='8.3|Win32'">C:\Program Files %28x86%29\PostgreSQL\8.3\lib;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='8.3|x64'">C:\Program Files %28x86%29\PostgreSQL\8.3\lib;$(LibraryPath)</LibraryPath>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|Win32'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|x64'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|Win32'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|x64'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|Win32'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|x64'">pg_reorg</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|Win32'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='9.0|x64'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|Win32'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.4|x64'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|Win32'">pg_repack</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='8.3|x64'">pg_repack</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='9.0|Win32'">
<ClCompile>

View File

@ -12,11 +12,11 @@
</ItemGroup>
<ItemGroup>
<None Include="..\lib\Makefile" />
<None Include="..\lib\pg_reorg.sql.in" />
<None Include="..\lib\uninstall_pg_reorg.sql" />
<None Include="..\lib\pg_repack.sql.in" />
<None Include="..\lib\uninstall_pg_repack.sql" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\lib\reorg.c">
<ClCompile Include="..\lib\repack.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\lib\pgut\pgut-spi.c">

View File

@ -115,7 +115,7 @@
>
</File>
<File
RelativePath="..\lib\reorg.c"
RelativePath="..\lib\repack.c"
>
</File>
</Filter>
@ -138,11 +138,11 @@
>
</File>
<File
RelativePath="..\lib\pg_reorg.sql.in"
RelativePath="..\lib\pg_repack.sql.in"
>
</File>
<File
RelativePath="..\lib\uninstall_pg_reorg.sql"
RelativePath="..\lib\uninstall_pg_repack.sql"
>
</File>
</Files>