Merge branch 'pg94'
This commit is contained in:
commit
4065470982
@ -2,7 +2,7 @@
|
|||||||
"name": "pg_repack",
|
"name": "pg_repack",
|
||||||
"abstract": "PostgreSQL module for data reorganization",
|
"abstract": "PostgreSQL module for data reorganization",
|
||||||
"description": "Reorganize tables in PostgreSQL databases with minimal locks",
|
"description": "Reorganize tables in PostgreSQL databases with minimal locks",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1-pg94",
|
||||||
"maintainer": [
|
"maintainer": [
|
||||||
"Josh Kupershmidt <schmiddy@gmail.com>",
|
"Josh Kupershmidt <schmiddy@gmail.com>",
|
||||||
"Daniele Varrazzo <daniele.varrazzo@gmail.com>",
|
"Daniele Varrazzo <daniele.varrazzo@gmail.com>",
|
||||||
@ -14,7 +14,7 @@
|
|||||||
"provides": {
|
"provides": {
|
||||||
"pg_repack": {
|
"pg_repack": {
|
||||||
"file": "lib/pg_repack.sql",
|
"file": "lib/pg_repack.sql",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1-pg94",
|
||||||
"abstract": "Reorganize tables in PostgreSQL databases with minimal locks"
|
"abstract": "Reorganize tables in PostgreSQL databases with minimal locks"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
4
Makefile
4
Makefile
@ -29,10 +29,6 @@ ifeq ($(shell echo $$(($(INTVERSION) < 803))),1)
|
|||||||
$(error $(EXTENSION) requires PostgreSQL 8.3 or later. This is $(VERSION))
|
$(error $(EXTENSION) requires PostgreSQL 8.3 or later. This is $(VERSION))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(shell echo $$(($(INTVERSION) >= 904))),1)
|
|
||||||
$(error $(EXTENSION) does not yet support PostgreSQL 9.4 or later. This is $(VERSION))
|
|
||||||
endif
|
|
||||||
|
|
||||||
SUBDIRS = bin lib regress
|
SUBDIRS = bin lib regress
|
||||||
|
|
||||||
all install installdirs uninstall distprep clean distclean maintainer-clean debug:
|
all install installdirs uninstall distprep clean distclean maintainer-clean debug:
|
||||||
|
@ -840,7 +840,7 @@ elog(int elevel, const char *fmt, ...)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ok = appendStringInfoVA(&edata->msg, fmt, args);
|
ok = pgut_appendStringInfoVA(&edata->msg, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
len = strlen(fmt);
|
len = strlen(fmt);
|
||||||
@ -1005,7 +1005,7 @@ errmsg(const char *fmt,...)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ok = appendStringInfoVA(&edata->msg, fmt, args);
|
ok = pgut_appendStringInfoVA(&edata->msg, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
len = strlen(fmt);
|
len = strlen(fmt);
|
||||||
@ -1026,7 +1026,7 @@ errdetail(const char *fmt,...)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ok = appendStringInfoVA(&edata->detail, fmt, args);
|
ok = pgut_appendStringInfoVA(&edata->detail, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
} while (!ok);
|
} while (!ok);
|
||||||
trimStringBuffer(&edata->detail);
|
trimStringBuffer(&edata->detail);
|
||||||
@ -1212,7 +1212,7 @@ exit_or_abort(int exitcode)
|
|||||||
* unlike the server code, this function automatically extend the buffer.
|
* unlike the server code, this function automatically extend the buffer.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
pgut_appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
size_t avail;
|
size_t avail;
|
||||||
int nprinted;
|
int nprinted;
|
||||||
|
@ -150,7 +150,7 @@ extern void CHECK_FOR_INTERRUPTS(void);
|
|||||||
#define appendStringInfoChar appendPQExpBufferChar
|
#define appendStringInfoChar appendPQExpBufferChar
|
||||||
#define appendBinaryStringInfo appendBinaryPQExpBuffer
|
#define appendBinaryStringInfo appendBinaryPQExpBuffer
|
||||||
|
|
||||||
extern bool appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
extern bool pgut_appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
|
||||||
__attribute__((format(printf, 2, 0)));
|
__attribute__((format(printf, 2, 0)));
|
||||||
extern int appendStringInfoFile(StringInfo str, FILE *fp);
|
extern int appendStringInfoFile(StringInfo str, FILE *fp);
|
||||||
extern int appendStringInfoFd(StringInfo str, int fd);
|
extern int appendStringInfoFd(StringInfo str, int fd);
|
||||||
|
@ -441,6 +441,10 @@ the original index.
|
|||||||
Releases
|
Releases
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
* pg_repack 1.3.1
|
||||||
|
|
||||||
|
* Added support for PostgreSQL 9.4.
|
||||||
|
|
||||||
* pg_repack 1.3
|
* pg_repack 1.3
|
||||||
|
|
||||||
* Added ``--schema`` to repack only the specified schema (issue #20).
|
* Added ``--schema`` to repack only the specified schema (issue #20).
|
||||||
|
@ -172,7 +172,10 @@ CREATE VIEW repack.tables AS
|
|||||||
SELECT R.oid::regclass AS relname,
|
SELECT R.oid::regclass AS relname,
|
||||||
R.oid AS relid,
|
R.oid AS relid,
|
||||||
R.reltoastrelid AS reltoastrelid,
|
R.reltoastrelid AS reltoastrelid,
|
||||||
CASE WHEN R.reltoastrelid = 0 THEN 0 ELSE (SELECT reltoastidxid FROM pg_class WHERE oid = R.reltoastrelid) END AS reltoastidxid,
|
CASE WHEN R.reltoastrelid = 0 THEN 0 ELSE (
|
||||||
|
SELECT indexrelid FROM pg_index
|
||||||
|
WHERE indrelid = R.reltoastrelid
|
||||||
|
AND indisvalid) END AS reltoastidxid,
|
||||||
N.nspname AS schemaname,
|
N.nspname AS schemaname,
|
||||||
PK.indexrelid AS pkid,
|
PK.indexrelid AS pkid,
|
||||||
CK.indexrelid AS ckid,
|
CK.indexrelid AS ckid,
|
||||||
|
@ -29,11 +29,20 @@ termStringInfo(StringInfo str)
|
|||||||
static void
|
static void
|
||||||
appendStringInfoVA_s(StringInfo str, const char *fmt, va_list args)
|
appendStringInfoVA_s(StringInfo str, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
|
#if PG_VERSION_NUM >= 90400
|
||||||
|
int needed;
|
||||||
|
while ((needed = appendStringInfoVA(str, fmt, args)) > 0)
|
||||||
|
{
|
||||||
|
/* Double the buffer size and try again. */
|
||||||
|
enlargeStringInfo(str, needed);
|
||||||
|
}
|
||||||
|
#else
|
||||||
while (!appendStringInfoVA(str, fmt, args))
|
while (!appendStringInfoVA(str, fmt, args))
|
||||||
{
|
{
|
||||||
/* Double the buffer size and try again. */
|
/* Double the buffer size and try again. */
|
||||||
enlargeStringInfo(str, str->maxlen);
|
enlargeStringInfo(str, str->maxlen);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* simple execute */
|
/* simple execute */
|
||||||
|
12
lib/repack.c
12
lib/repack.c
@ -784,12 +784,12 @@ repack_swap(PG_FUNCTION_ARGS)
|
|||||||
/* swap relfilenode and dependencies for tables. */
|
/* swap relfilenode and dependencies for tables. */
|
||||||
values[0] = ObjectIdGetDatum(oid);
|
values[0] = ObjectIdGetDatum(oid);
|
||||||
execute_with_args(SPI_OK_SELECT,
|
execute_with_args(SPI_OK_SELECT,
|
||||||
"SELECT X.reltoastrelid, TX.reltoastidxid, X.relowner,"
|
"SELECT X.reltoastrelid, TX.indexrelid, X.relowner,"
|
||||||
" Y.oid, Y.reltoastrelid, TY.reltoastidxid, Y.relowner"
|
" Y.oid, Y.reltoastrelid, TY.indexrelid, Y.relowner"
|
||||||
" FROM pg_catalog.pg_class X LEFT JOIN pg_catalog.pg_class TX"
|
" FROM pg_catalog.pg_class X LEFT JOIN pg_catalog.pg_index TX"
|
||||||
" ON X.reltoastrelid = TX.oid,"
|
" ON X.reltoastrelid = TX.indrelid AND TX.indisvalid,"
|
||||||
" pg_catalog.pg_class Y LEFT JOIN pg_catalog.pg_class TY"
|
" pg_catalog.pg_class Y LEFT JOIN pg_catalog.pg_index TY"
|
||||||
" ON Y.reltoastrelid = TY.oid"
|
" ON Y.reltoastrelid = TY.indrelid AND TY.indisvalid"
|
||||||
" WHERE X.oid = $1"
|
" WHERE X.oid = $1"
|
||||||
" AND Y.oid = ('repack.table_' || X.oid)::regclass",
|
" AND Y.oid = ('repack.table_' || X.oid)::regclass",
|
||||||
1, argtypes, values, nulls);
|
1, argtypes, values, nulls);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user