Code

postrr.git
10 years agopostrr.sql: Use "LANGUAGE C" rather than "LANGUAGE 'C'". master
Sebastian Harl [Fri, 8 Nov 2013 13:27:37 +0000 (14:27 +0100)]
postrr.sql: Use "LANGUAGE C" rather than "LANGUAGE 'C'".

10 years agoFixed compilation with PostgreSQL 9.2.
Sebastian Harl [Fri, 8 Nov 2013 13:19:10 +0000 (14:19 +0100)]
Fixed compilation with PostgreSQL 9.2.

Now, it doesn't compile with 9.1, though, but that's old anyway ;-)

11 years agoRemoved patch version from the extension's version.
Sebastian Harl [Mon, 12 Nov 2012 21:17:43 +0000 (22:17 +0100)]
Removed patch version from the extension's version.

Features won't change between patch versions but only between minor versions.

11 years agosrc/Makefile: Make sure to re-create postrr.control on 'make all'.
Sebastian Harl [Mon, 12 Nov 2012 20:38:50 +0000 (21:38 +0100)]
src/Makefile: Make sure to re-create postrr.control on 'make all'.

11 years agopostrr.control: Set relocatable to false.
Sebastian Harl [Mon, 12 Nov 2012 20:37:36 +0000 (21:37 +0100)]
postrr.control: Set relocatable to false.

The extension may not be relocated, except when it's created because it used
another schema (postrr) internally.

11 years agoAdded support for installing PostRR as an extension.
Sebastian Harl [Mon, 12 Nov 2012 20:24:11 +0000 (21:24 +0100)]
Added support for installing PostRR as an extension.

 * Added initial control file (generated by configure from .in)
 * Moved postrr.sql to postrr--VERSION.sql
 * Abort, if the SQL file is loaded directly (-> force the use of the
   extension)
 * Simply use 'DROP EXTENSION' in uninstall_postrr.sql

11 years agopgtest.sh: Added dump/restore commands.
Sebastian Harl [Mon, 12 Nov 2012 10:38:43 +0000 (11:38 +0100)]
pgtest.sh: Added dump/restore commands.

11 years agoCData: Added support for undefined values.
Sebastian Harl [Mon, 12 Nov 2012 10:29:53 +0000 (11:29 +0100)]
CData: Added support for undefined values.

NaN will be treated as undefined value.

11 years agoPostRR_update(): Fixed handling of multiple columns in the same table.
Sebastian Harl [Fri, 9 Nov 2012 07:41:06 +0000 (08:41 +0100)]
PostRR_update(): Fixed handling of multiple columns in the same table.

Previously, after updating the first column, the next columns would already
find a matching timeslice (by timestamp), thus updating the old value.

Now, all old data will simply be removed (for timeslices which are strictly
older than the new timestamp (by timestamp)). This ensures that all data
related to the old timestamp is removed.

Note: However, this *might* destroy unrelated data as well in case a user
stores additional information in that table. For now, I will simply ignore
that as I don't see any reasonable justification for doing so ;-)

11 years agoRRTimeslice: Added cast from timestamptz to rrtimeslice.
Sebastian Harl [Thu, 8 Nov 2012 06:57:57 +0000 (07:57 +0100)]
RRTimeslice: Added cast from timestamptz to rrtimeslice.

11 years agoPostRR_update(): Use rrtimeslice_cmp() to decide how to do the update.
Sebastian Harl [Wed, 7 Nov 2012 20:28:45 +0000 (21:28 +0100)]
PostRR_update(): Use rrtimeslice_cmp() to decide how to do the update.

That is, added support for overwriting old values and reporting errors if the
given timestamp is older than the appropriate timestamp in the database (which
is the entry having the same sequence number).

11 years agoRRTimeslice: Added rrtimeslice_cmp().
Sebastian Harl [Wed, 7 Nov 2012 20:25:58 +0000 (21:25 +0100)]
RRTimeslice: Added rrtimeslice_cmp().

This function compares two timeslices by timestamp. It returns values less
than zero, zero or greater than zero if the first timestamp is smaller than,
equal to or greater than the second.

Values -2 / 2 indicate that the sequence numbers don't match while values
-1 / 1 indicate that they do match.

11 years agopostrr.sql: Removed unnecessary aliases.
Sebastian Harl [Sun, 4 Nov 2012 14:37:23 +0000 (15:37 +0100)]
postrr.sql: Removed unnecessary aliases.

Rather, turn them into comments ;-)

11 years agopostrr.sql: Don't use 'EXECUTE' in PostRR_update().
Sebastian Harl [Sun, 4 Nov 2012 14:35:07 +0000 (15:35 +0100)]
postrr.sql: Don't use 'EXECUTE' in PostRR_update().

This will, hopefully, improve performance a bit.

11 years agoconfigure: Don't output the build date in the summary.
Sebastian Harl [Tue, 30 Oct 2012 15:40:37 +0000 (16:40 +0100)]
configure: Don't output the build date in the summary.

This was broken anyway and is not used in any other place.

11 years agoCData: Use errdetail() rather than errhint() to report details ;-)
Sebastian Harl [Tue, 30 Oct 2012 08:57:59 +0000 (09:57 +0100)]
CData: Use errdetail() rather than errhint() to report details ;-)

11 years agoRRTimeslice: Quote the lower/upper bounds in the range output.
Sebastian Harl [Tue, 30 Oct 2012 07:03:28 +0000 (08:03 +0100)]
RRTimeslice: Quote the lower/upper bounds in the range output.

11 years agoRRTimeslice: Updated output format to <range> #<seq>/<num>.
Sebastian Harl [Tue, 30 Oct 2012 06:55:42 +0000 (07:55 +0100)]
RRTimeslice: Updated output format to <range> #<seq>/<num>.

That is, format the timeslice in a range format (cf. tstzrange in PostgreSQL
9.2). I suppose this is easier to read for humans, even though it's a bit
longer. Also, include the number of timeslices in addition to the sequence
number as well. This way, we're able to unambiguously parse the output.

11 years agoCData: Fixed handling of whitespace + garbage detection at end of input.
Sebastian Harl [Tue, 30 Oct 2012 06:41:20 +0000 (07:41 +0100)]
CData: Fixed handling of whitespace + garbage detection at end of input.

WTF happened there?!? ;-)

11 years agoRRTimeslice: Don't encode invalid (0) intervals in the output function.
Sebastian Harl [Tue, 30 Oct 2012 06:24:02 +0000 (07:24 +0100)]
RRTimeslice: Don't encode invalid (0) intervals in the output function.

11 years agopostrr.h: Updated prototype for rrtimeslice_to_timestamptz().
Sebastian Harl [Tue, 30 Oct 2012 06:19:17 +0000 (07:19 +0100)]
postrr.h: Updated prototype for rrtimeslice_to_timestamptz().

11 years agoRRTimeslice: Use TimestampTz rather than timestamp without time zone.
Sebastian Harl [Mon, 29 Oct 2012 13:47:17 +0000 (14:47 +0100)]
RRTimeslice: Use TimestampTz rather than timestamp without time zone.

This will, hopefully, avoid a whole lota problems when it comes to using
PostRR with daylight savings time, different time zones, etc.

11 years agobase: Include extra version information in postrr_version() output.
Sebastian Harl [Mon, 29 Oct 2012 13:41:27 +0000 (14:41 +0100)]
base: Include extra version information in postrr_version() output.

11 years agopgtest.sh: Make it possible to specify PG_CONFIG thru the environment.
Sebastian Harl [Mon, 29 Oct 2012 13:40:39 +0000 (14:40 +0100)]
pgtest.sh: Make it possible to specify PG_CONFIG thru the environment.

11 years agouninstall_postrr.sql: Drop table "postrr.rrarchives".
Sebastian Harl [Mon, 29 Oct 2012 12:01:36 +0000 (13:01 +0100)]
uninstall_postrr.sql: Drop table "postrr.rrarchives".

11 years agopostrr.sql: Added PostRR_update() functions.
Sebastian Harl [Tue, 23 Oct 2012 11:34:56 +0000 (13:34 +0200)]
postrr.sql: Added PostRR_update() functions.

These functions may be used to insert or update a value in an archive. The
functions expect a timestamp and double precision value as arguments to
describe the new values. The postrr.rrarchives will then be used to look up
the actual place where to store the values (there may be multiple ones).

There are currently two overloaded versions of this function. One accepts the
name of an archive and the other expects the definition of an archive as
arguments. The latter is meant to be used for internal purposes while the
other is meant to be used by the user. This is not enforced in any way, though
(and I don't see any reason to do so).

11 years agopostrr.sql: Added 'postrr.rrarchives' table.
Sebastian Harl [Tue, 23 Oct 2012 11:31:36 +0000 (13:31 +0200)]
postrr.sql: Added 'postrr.rrarchives' table.

This table will be used to store "Round Robin Archive" definitions. Each
archive has a name which may be used to identify the archive and a description
of the table(s) that store the values of the archive. Each entry specifies the
table as well as the RRTimeslice and CData columns to be used for storing the
values.

11 years agopgtest.sh: Added documentation for 'restart'.
Sebastian Harl [Tue, 23 Oct 2012 11:04:25 +0000 (13:04 +0200)]
pgtest.sh: Added documentation for 'restart'.

11 years agopgtest.sh: Added 'restart' command.
Sebastian Harl [Tue, 23 Oct 2012 11:03:26 +0000 (13:03 +0200)]
pgtest.sh: Added 'restart' command.

This will restart the PostgreSQL server in the background if it was running
previously.

11 years agoCData: Check both arguments of CData_update() for NULL.
Sebastian Harl [Tue, 23 Oct 2012 11:02:58 +0000 (13:02 +0200)]
CData: Check both arguments of CData_update() for NULL.

11 years agoCData: Declared CData_update() as not strict.
Sebastian Harl [Tue, 23 Oct 2012 10:49:11 +0000 (12:49 +0200)]
CData: Declared CData_update() as not strict.

Any or all arguments may in fact be NULL. This happens, e.g., when updating
single CData columns one by one. In this case, use the other argument as
return value, i.e. leaving it unmodified.

11 years agoCData: Include CF function in output string.
Sebastian Harl [Tue, 23 Oct 2012 10:34:01 +0000 (12:34 +0200)]
CData: Include CF function in output string.

This makes all information available that are required to regenerate the same
CData object from the stringified version.

11 years agopgtest.sh: Exit with status zero when using the 'help' command.
Sebastian Harl [Mon, 22 Oct 2012 08:50:09 +0000 (10:50 +0200)]
pgtest.sh: Exit with status zero when using the 'help' command.

11 years agopgtest.sh: Improved help/usage output.
Sebastian Harl [Mon, 22 Oct 2012 08:49:10 +0000 (10:49 +0200)]
pgtest.sh: Improved help/usage output.

11 years agopgtest.sh: Changed PostgreSQL port to 2345.
Sebastian Harl [Thu, 18 Oct 2012 13:49:46 +0000 (15:49 +0200)]
pgtest.sh: Changed PostgreSQL port to 2345.

This is somewhat related to the default port (5432) but we can probably be
fairly sure this is not used otherwise.

11 years agopgtest.sh: 'setup': Create database for the current user.
Sebastian Harl [Sun, 14 Oct 2012 21:17:30 +0000 (23:17 +0200)]
pgtest.sh: 'setup': Create database for the current user.

… rather than using a hard-coded value.

11 years agopostrr_comments.sql: Added comment for CData type.
Sebastian Harl [Sun, 14 Oct 2012 21:13:36 +0000 (23:13 +0200)]
postrr_comments.sql: Added comment for CData type.

11 years agopostrr.7: Added a short description for the CData data type.
Sebastian Harl [Sun, 14 Oct 2012 21:12:02 +0000 (23:12 +0200)]
postrr.7: Added a short description for the CData data type.

11 years agoconfigure: Added a few "checking ..." messages for convenience.
Sebastian Harl [Sun, 14 Oct 2012 21:02:19 +0000 (23:02 +0200)]
configure: Added a few "checking ..." messages for convenience.

11 years agoconfigure.ac: Replaced place-holder help text.
Sebastian Harl [Sun, 14 Oct 2012 20:46:49 +0000 (22:46 +0200)]
configure.ac: Replaced place-holder help text.

11 years agoautogen.sh: Improved "help" output.
Sebastian Harl [Sun, 14 Oct 2012 20:41:09 +0000 (22:41 +0200)]
autogen.sh: Improved "help" output.

11 years agoCData: added a cast to double precision.
Sebastian Harl [Thu, 10 May 2012 13:10:58 +0000 (15:10 +0200)]
CData: added a cast to double precision.

The cast may only be done explicitly.

11 years agoCData: Added cdata_update().
Sebastian Harl [Thu, 10 May 2012 12:35:54 +0000 (14:35 +0200)]
CData: Added cdata_update().

This function may be used to update an existing data set by "merging" another
data set according to the consolidation function.

11 years agoRRTimeslice: added a cast to timestamp.
Sebastian Harl [Wed, 9 May 2012 15:24:19 +0000 (17:24 +0200)]
RRTimeslice: added a cast to timestamp.

11 years agoRRTimeslice: Changed all comparison operators to compare SEQ only.
Sebastian Harl [Tue, 8 May 2012 13:51:13 +0000 (15:51 +0200)]
RRTimeslice: Changed all comparison operators to compare SEQ only.

Else, a b-tree won't work (d'oh!).

11 years agorrtimeslice: Added hash function and operator class.
Sebastian Harl [Thu, 3 May 2012 19:44:08 +0000 (21:44 +0200)]
rrtimeslice: Added hash function and operator class.

11 years agopgtest.sh: Pass additional arguments to client and start.
Sebastian Harl [Mon, 30 Apr 2012 14:29:31 +0000 (16:29 +0200)]
pgtest.sh: Pass additional arguments to client and start.

Also, check for any additional arguments in all other commands.

11 years agoCData: Added casts from integer and numeric to cdata.
Sebastian Harl [Mon, 30 Apr 2012 12:52:34 +0000 (14:52 +0200)]
CData: Added casts from integer and numeric to cdata.

Both casts are marked 'AS ASSIGNMENT'.

11 years agoCData: Use float8 rather than double.
Sebastian Harl [Mon, 30 Apr 2012 12:51:30 +0000 (14:51 +0200)]
CData: Use float8 rather than double.

This makes the storage size explicit.

11 years agouninstall_postrr.sql: Drop CData type and all related functions, casts, too.
Sebastian Harl [Sun, 29 Apr 2012 18:50:06 +0000 (20:50 +0200)]
uninstall_postrr.sql: Drop CData type and all related functions, casts, too.

11 years agoCData: Added support for a type modifier.
Sebastian Harl [Sun, 29 Apr 2012 18:49:12 +0000 (20:49 +0200)]
CData: Added support for a type modifier.

The type modifier may be any of 'MIN', 'AVG', 'MAX', specifying the
consolidation function to be used.

11 years agoCData: fixed typo: RRTIMESLICE → CDATA.
Sebastian Harl [Sun, 29 Apr 2012 18:39:58 +0000 (20:39 +0200)]
CData: fixed typo: RRTIMESLICE → CDATA.

Since the affected macro basically did the same, this error did not matter
much, though.

11 years agoAdded initial version of the CData data type.
Sebastian Harl [Sat, 28 Apr 2012 17:35:57 +0000 (19:35 +0200)]
Added initial version of the CData data type.

For now, the type provides simple input and output functions only.

11 years agopgtest.sh: Added a small helper script to setup/run a PG test setup.
Sebastian Harl [Sat, 28 Apr 2012 15:57:02 +0000 (17:57 +0200)]
pgtest.sh: Added a small helper script to setup/run a PG test setup.

11 years agoInitial import of PostRR -- the PostgreSQL Round-Robin Extension. postrr-0.0.0
Sebastian Harl [Sat, 28 Apr 2012 15:33:10 +0000 (17:33 +0200)]
Initial import of PostRR -- the PostgreSQL Round-Robin Extension.

For now, this is an early and highly experimental incomplete draft ;-)

The current version provides a new data type "RRTimeslice" implementing basic
round-robin features. It is defined by the length of the slice and the number
of slices before wrapping around, both specified using the type modifier. It
provides basic comparison operators and an operator class for the btree
indexing method.