Commit Graph

139 Commits

Author SHA1 Message Date
18f75951e2 Remove generated blank lines from legacy .sql file
They appear cause portability problems.
Fixes issue #12.
2013-11-05 02:24:42 +00:00
d1ab1f7882 Check "relkind" instead of "reltype" in pg_class for clarity. 2013-07-08 09:20:40 -04:00
b804c150ac Fix existing 'tablespace' regression test so it passes again.
Changes to repack_indexdef() had broken this test.
2013-06-22 06:47:06 -04:00
f3fa2fa563 Fixes and cleanup of the new repack_index_swap():
* Make sure we don't crash if this function is fed a bogus OID
 * rename idx1, idx2 variables for clarity
 * tweak query against pg_class to specify reltype = 0
 * CommandCounterIncrement() is probably unnecessary, removed
2013-06-21 20:58:54 -04:00
ee23ec8ffd Initial import of indexes-only building patch.
Patch from Beena Emerson.
2013-06-21 18:41:09 -04:00
9c8d519415 Kludge to remove -lpam from LIBS in Makefiles.
Per Issue #7 from armanddp, it seems the RHEL/CentOS packages
of Postgres are built against libpam, which shows up in
the LIBS reported by pg_config. We don't actually need to
link in libpam for pg_repack, so manually remove it from
our LIBS. This helps a little bit for building on
RHEL/CentOS, though the issue of libpgport.a missing
on that platform still looms.
2013-05-23 20:31:56 -04:00
95ce24c2a0 More sed tweaks to Makefile for portability.
The -E flag to specify extended regular expressions apparently is
not portable to all platforms, such as CentOS 4.5. Use an uglier
but hopefully more portable basic regular expression in Makefiles.
2013-05-21 21:45:47 -04:00
20dea46184 Merge remote-tracking branch 'piro/master' 2013-05-05 00:19:22 +01:00
98d304712c Merge branch 'funky-version-check'
Conflicts:
	bin/expected/repack.out
	bin/sql/repack.sql
2013-05-05 00:09:39 +01:00
a561c924f7 Parse tablespace/where in parse_indexdef
Makes injecting the target tablespace much easier and fixes interaction
between tablespace and WITH/WHERE clauses.

Added tests to check the correct indexes definition.
2013-05-05 00:07:14 +01:00
cc2abf4b25 Fixed tablespace assignment in index with WITH clause
Reported by Beena Emerson.
2013-05-02 23:32:30 +01:00
c55c613e44 Update RENAME_REL macro to work with 9.3. We now need to pass the
"is_internal" boolean to this function; for our purposes it should
be acceptable to always pass true.
2013-04-23 21:32:30 -04:00
109689586e Fixed access to uninit'd mem in repack_indexdef
If the tablespace is the last token in the indexdef, skip_ident returns a
pointer *after* the term zero, so garbage may end up after the statement.
2013-04-22 00:48:53 +01:00
a2138b6d7d Ignore AFTER triggers sorting after z_repack_trigger
They are not a problem, and they fore after the BEFORE trigger anyway.

To be checked against more PostgreSQL versions.
2013-04-18 01:22:24 +01:00
477fba884c Ignore AFTER triggers sorting after z_repack_trigger
They are not a problem, and they fore after the BEFORE trigger anyway.

To be checked against more PostgreSQL versions.
2013-04-18 01:19:52 +01:00
14c4d4653e Make the version number arith without using bc
Not as available as I thought.

Can't use the 0 prefix to make the 3rd number optional as $(()) parses is as
octal, so only use the first 2 numbers.

Also fixed collate test: not available on PG 9.0.
2013-04-18 01:10:22 +01:00
c314cbda75 Check PostgreSQL version number as number in the makefile
Not entirely happy about the solution but I like the uniform tests.
2013-04-18 00:29:23 +01:00
22762fce28 Fixed query for PG 8.3
The AS keyword was required.
2013-04-17 22:08:37 +01:00
42c65d16f8 Merge branch 'change-tablespace'
Conflicts:
	bin/pg_repack.c
	doc/pg_repack.rst
2013-04-17 09:07:09 +01:00
1d62d8d0c5 More helpful error messages in case of conflicting triggers
Closes issue #5.
2013-04-17 00:57:01 +01:00
d98a14bb55 Fixed index definition tokenization
In the previous commit skip_const was going ahead the space thus removing the
starting quote. Also fixed (and tested) trailing part after the tablespace
name, e.g. the WHERE clause.
2013-04-16 23:23:26 +01:00
83fdb2a9e0 Added implementation for --moveidx
Note: if original namespace is "foo bar", repack_indexdef gives a bad
result. This is weird as apparently skip_ident can deal with spaces in
a quoted identifier. Committing as I'm going home, will deal with that
later.
2013-04-16 22:42:23 +01:00
a6e50515ce Merge branch 'master' into change-tablespace 2013-04-16 22:40:43 +01:00
6710e514db Added --namespace option to set the namespace of repacked tables
Bumped version number to enforce extension re-creation as the SQL has
been modified.

Current limitations:

- Check for namespace existence: on error temp objects are left around
- What happens to the indexes?
- Tests needed.
- Should the default be the GUC default_tablespace instead of pg_default?
  This is actually an original pg_repack shortcoming, not a regression.
2013-02-21 17:20:54 +00:00
13cf8679db Added support for COLLATE to index keys 2012-12-09 12:02:49 +00:00
4bcb7641c9 Function get_index_keys() renamed to get_order_by()
It was a FIXME item in the source. Reasonably so.
2012-12-09 11:35:52 +00:00
a47686a7ee Added support for DESC and NULLS FIRST/LAST to index keys
Fixes issue #3
2012-12-09 01:11:39 +00:00
d402a73e42 No need to use strlen() with StringInfoData. 2012-11-26 20:08:47 -07:00
d13f1b141d Merge branch 'version_check' 2012-11-16 21:32:45 +00:00
deaae7dd72 Added version_sql() function and consistency check of sql version 2012-11-16 21:32:28 +00:00
e02811689a Fixed non-portable use of sed to parse the version from META
Patch from Josh, with the help of RhodiumToad.
2012-11-16 10:36:16 +00:00
0af231dff5 Use a single version number for program, library and SQL
Having the SQL on a different numbering scheme is useful to provide an ungrade
path. But pg_repack has no need of such a path as it can be uninstalled with
no problem, so we are not going to provide update script. Hence it's much
easier to have a single version number for everything.
2012-11-15 23:31:58 +00:00
77d27a14f3 Use the same title of README/docs for the extension 2012-11-15 13:53:06 +00:00
44bf1543be Don't choose a partial index as primary key
Fixes reorg/pg_reorg#22
2012-11-15 00:16:38 +00:00
673a8ea100 The repack schema is contained in the pg_repack extension
...not the other way around. This allows DROP EXTENSION ... CASCADE to
remove temporary directories, simplifying the cleanup procedure after an
error, and getting rid of the schema on uninstall.
2012-11-13 14:02:45 +00:00
6f8a8bab6d support for ENABLE TRIGGER renamed to enable_trigger from alter_table 2012-11-12 11:51:20 +00:00
532be6ea25 Provide a single way to install pg_repack
Provide only CREATE EXTENSION support on PG >= 9.1 and only the sql script on
PG < 9.1.

Also dropped the /echo cruft in the extension script: it is broken on pg 9.1
and 9.1.1, and because the script is not installed on versions that don't
support CREATE EXTENSION it is just not terribly useful.
2012-11-12 01:04:46 +00:00
ac068cc69b Script to create extension from loose objects dropped altogether
pg_repack doesn't create any object to depend on, so it is always possible drop
it and install a new version instead of upgrading. Creating a robust upgrade
path from loose objects which can be of any version to a target version is
hopelessly brittle, so I'd suggest the user just to drop a previous pg_repack
version and install the new one.
2012-11-12 00:20:41 +00:00
390feca0e1 Dropped the last compatibility macros for PG 8.2 2012-11-11 23:51:46 +00:00
95c196dd33 Have get_quoted_relname(), get_quoted_nspname(), and reorg_drop() sanity check arguments to prevent NULL pointer dereferencing and backend crash.
Fix for Issue #20.
2012-11-11 23:09:59 +00:00
7b84eeb010 Get the program and library version from the META file 2012-11-11 18:30:27 +00:00
71af7f20be Dropped support for building "in tree": always use PGXS 2012-11-11 17:17:41 +00:00
1d60a946ff Added The Reorg Development Team copyright 2012-11-11 03:00:00 +00:00
db1c554f60 Dropped executable flags 2012-11-11 02:48:46 +00:00
b7799c1782 Fork the pg_repack extension 2012-11-10 22:33:57 +00:00
0f8c33f72f Don't use a generic 'unpackaged' version
The behaviour of the script is not really predictable if it is run on the
loose objects of pg_reorg >= 1.1.8. So let's be explicit about what version
we expect as starting point.
2012-11-10 22:02:10 +00:00
bd06ec0091 Program metadata version moved to 1.2dev0 2012-11-10 19:59:19 +00:00
883b9b5b28 Don't add the schema to the extension
It is an error to do so.
2012-11-10 19:52:35 +00:00
8b8b859ad3 Create both the standalone and extension sql scripts from the same .in 2012-11-10 19:52:28 +00:00
a2fa346eff Fixed create extension from unpackaged
Fixed syntax of create aggregate and an extra brace.
Schema added to the extension.
2012-11-10 19:51:47 +00:00