pgslice 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d43d6ab9a3394ef28e8db635df3d871224b820b
4
- data.tar.gz: 20b24a285377ebdd908e08d70d77a53c12e7a8b4
3
+ metadata.gz: dca58e320a519d76827d4e80a0ac06f6de27c6a4
4
+ data.tar.gz: 42c56e058c53df60248f805215cae4b42ce71246
5
5
  SHA512:
6
- metadata.gz: 9e595c90abf4444c538c23b62fc52592f6095ceb5ddc715c6d537c87b337e1bd7663f794364d080edb9943041f98fd93cdadb434ce5976746ad01348225e48a8
7
- data.tar.gz: 4e4081d488e8f024f0ce3f47f238657debb69b1418194ca0562814aa2825a0e9527848cab90c91b93d984a90692a0b56310e55a01578d38a738fcfb33f80513a
6
+ metadata.gz: f25931d431807f8e8a6155042f4a87a2bd76812d4d28b09b6f283e9445996e9a2a86f3991eff1c2f274b9b8afddd1e1ea9c31e6794a8c623f5aebee3fa20c1a6
7
+ data.tar.gz: fc9fe5a59c005c348ff19ec3e1ecf7ff946a9af2fca577ca6566360367b0b1ae3b810fce17375c69973d6720db54eebd2f2737de4c6c414f91ce6e6aec66abac
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.3
2
+
3
+ - Fixed error when creating partitions
4
+
1
5
  ## 0.3.2
2
6
 
3
7
  - Exit with error code on interrupt
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 the value after the insert with `SELECT CURRVAL('sequence_name')`
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| /#{Regexp.escape("#{original_table}_")}(\d{4,6})/.match(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| /#{Regexp.escape("#{table}_")}(\d{4,6})/.match(t) }.sort
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)
@@ -1,3 +1,3 @@
1
1
  module PgSlice
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
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.2
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: 2016-12-15 00:00:00.000000000 Z
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.5.1
106
+ rubygems_version: 2.6.8
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Postgres partitioning as easy as pie