pgslice 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/pgslice.rb +2 -2
- data/lib/pgslice/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dca58e320a519d76827d4e80a0ac06f6de27c6a4
|
4
|
+
data.tar.gz: 42c56e058c53df60248f805215cae4b42ce71246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f25931d431807f8e8a6155042f4a87a2bd76812d4d28b09b6f283e9445996e9a2a86f3991eff1c2f274b9b8afddd1e1ea9c31e6794a8c623f5aebee3fa20c1a6
|
7
|
+
data.tar.gz: fc9fe5a59c005c348ff19ec3e1ecf7ff946a9af2fca577ca6566360367b0b1ae3b810fce17375c69973d6720db54eebd2f2737de4c6c414f91ce6e6aec66abac
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -263,7 +263,7 @@ This set up allows you to read and write with the original table name with no kn
|
|
263
263
|
If you use `INSERT` statements with a `RETURNING` clause (as frameworks like Rails do), you’ll no longer receive the id of the newly inserted record(s) back. If you need this, you can either:
|
264
264
|
|
265
265
|
1. Insert directly into the partition
|
266
|
-
2. Get
|
266
|
+
2. Get value before the insert with `SELECT nextval('sequence_name')` (for multiple rows, append `FROM generate_series(1, n)`)
|
267
267
|
|
268
268
|
### Reads
|
269
269
|
|
data/lib/pgslice.rb
CHANGED
@@ -170,7 +170,7 @@ CREATE TABLE #{partition_name}
|
|
170
170
|
future_defs = []
|
171
171
|
past_defs = []
|
172
172
|
name_format = self.name_format(period)
|
173
|
-
existing_tables = self.existing_tables(like: "#{original_table}_%").select { |t|
|
173
|
+
existing_tables = self.existing_tables(like: "#{original_table}_%").select { |t| /\A#{Regexp.escape("#{original_table}_")}\d{6,8}\z/.match(t) }
|
174
174
|
existing_tables = (existing_tables + added_partitions).uniq.sort
|
175
175
|
|
176
176
|
existing_tables.each do |table|
|
@@ -234,7 +234,7 @@ CREATE OR REPLACE FUNCTION #{trigger_name}()
|
|
234
234
|
if period
|
235
235
|
name_format = self.name_format(period)
|
236
236
|
|
237
|
-
existing_tables = self.existing_tables(like: "#{table}_%").select { |t|
|
237
|
+
existing_tables = self.existing_tables(like: "#{table}_%").select { |t| /\A#{Regexp.escape("#{table}_")}\d{6,8}\z/.match(t) }.sort
|
238
238
|
if existing_tables.any?
|
239
239
|
starting_time = DateTime.strptime(existing_tables.first.split("_").last, name_format)
|
240
240
|
ending_time = advance_date(DateTime.strptime(existing_tables.last.split("_").last, name_format), period, 1)
|
data/lib/pgslice/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgslice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.6.8
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Postgres partitioning as easy as pie
|