pg_partman.git / summary / log / commit / refs
commit 59efeb1676efd86abc5cae2fc6a98b060b99bb2d
Author: Keith Fiske <keith@keithf4.com>
Date: Tue Sep 11 20:55:15 2012 +0000
Made simple install script and added installation instructions. Not yet in extension form
README.md | 10 ++++++-
install.sql | 17 +++++++++++
sql/functions/create_next_id_partition.sql | 47 ------------------------------
3 files changed, 26 insertions(+), 48 deletions(-)
diff --git a/README.md b/README.md
index bac4e65..8af4e59 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,13 @@
+INSTALLATION
+-----------
+Still in early development, so not actually in extension format yet. Run install.sql located in root directory with psql from the pg_partman top level folder.
+
+ cd pg_partman
+ psql < install.sql
+
+
LICENSE AND COPYRIGHT
----------------------
+-------------------
PG Partition Manager (pg_partman) is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
diff --git a/install.sql b/install.sql
new file mode 100644
index 0000000..e5afdcb
--- /dev/null
+++ b/install.sql
@@ -0,0 +1,17 @@
+-- Run this script from the pg_partman top folder with psql command line tool to install pg_partman.
+
+DROP SCHEMA IF EXISTS part CASCADE;
+CREATE SCHEMA part;
+
+\i sql/types/types.sql
+\i sql/tables/tables.sql
+\i sql/functions/create_id_function.sql
+\i sql/functions/create_id_partition.sql
+\i sql/functions/create_next_time_partition.sql
+\i sql/functions/create_parent.sql
+\i sql/functions/create_time_function.sql
+\i sql/functions/create_time_partition.sql
+\i sql/functions/create_trigger.sql
+--\i sql/functions/
+\i sql/functions/run_maintenance.sql
+
diff --git a/sql/functions/create_next_id_partition.sql b/sql/functions/create_next_id_partition.sql
deleted file mode 100644
index 81e9b2e..0000000
--- a/sql/functions/create_next_id_partition.sql
+++ /dev/null
@@ -1,47 +0,0 @@
-CREATE OR REPLACE FUNCTION part.create_next_id_partition (p_parent_table text) RETURNS void
- LANGUAGE plpgsql
- AS $$
-DECLARE
-
-v_control text;
-v_datetime_string text;
-v_last_partition text;
-v_next_partition_timestamp timestamp;
-v_part_interval interval;
-v_tablename text;
-v_type part.partition_type;
-
-
-BEGIN
-
-SELECT type
- , part_interval::interval
- , control
- , datetime_string
- , last_partition
-FROM part.part_config
-WHERE parent_table = p_parent_table
-AND (type = 'time-static' OR type = 'time-dynamic')
-INTO v_type, v_part_interval, v_control, v_datetime_string, v_last_partition;
-IF NOT FOUND THEN
- RAISE EXCEPTION 'ERROR: no config found for %', p_parent_table;
-END IF;
-
--- Double check that last created partition exists
-IF v_last_partition IS NOT NULL THEN
- SELECT tablename INTO v_tablename FROM pg_tables WHERE schemaname || '.' || tablename = p_parent_table;
- IF v_tablename IS NULL THEN
- RAISE EXCEPTION 'ERROR: previous partition missing. Unable to determine proper next partition name';
- END IF;
-END IF;
-
--- pull out datetime portion of last partition's tablename
-v_next_partition_timestamp := to_timestamp(substring(v_last_partition from char_length(p_parent_table||'_p')+1), v_datetime_string) + v_part_interval;
-
-EXECUTE 'SELECT part.create_time_partition('||quote_literal(p_parent_table)||','||quote_literal(v_control)||','||quote_literal(v_part_interval)||','
- ||quote_literal(v_datetime_string)||','||quote_literal(ARRAY[v_next_partition_timestamp])||')' INTO v_last_partition;
-
-UPDATE part.part_config SET last_partition = v_last_partition WHERE parent_table = p_parent_table;
-
-END
-$$;
[parent: ba2dd69a567f]