pg_examiner 0.4.2 → 0.4.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/lib/pg_examiner/result.rb +1 -1
- data/lib/pg_examiner/version.rb +1 -1
- data/spec/index_spec.rb +12 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52b286b1541c6b5c4bae49271dbb37a1f75273bf
|
4
|
+
data.tar.gz: 8fe536e9f6af7a96a2a0780abb42db432cc33f4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7599ff717e5d701631fa20608daaa36c36c6122f1279b2faf11e0dacdc9a479f62f45cec2ce98faa539e292267ccaff035bfbfa7d8074da6cfcc1bd6962f50a
|
7
|
+
data.tar.gz: 5ac072b2cee56fe350785c53b4fc33fbc8d9e3d2ef795934d86a79e2ff597f1e90bbdca1b4d8d82942eef75525f3073d71ab46f2f89f94e02e08af6c8f861236
|
data/lib/pg_examiner/result.rb
CHANGED
@@ -84,7 +84,7 @@ module PGExaminer
|
|
84
84
|
|
85
85
|
@pg_index = load_table @pg_class.map{|ns| ns['oid']}, <<-SQL
|
86
86
|
SELECT c.relname AS name, i.indrelid, i.indkey, indisunique, indisprimary,
|
87
|
-
pg_get_expr(i.indpred, i.
|
87
|
+
pg_get_expr(i.indpred, i.indrelid) AS filter,
|
88
88
|
pg_get_expr(i.indexprs, i.indrelid) AS expression
|
89
89
|
FROM pg_index i
|
90
90
|
JOIN pg_class c ON c.oid = i.indexrelid
|
data/lib/pg_examiner/version.rb
CHANGED
data/spec/index_spec.rb
CHANGED
@@ -76,27 +76,30 @@ describe PGExaminer do
|
|
76
76
|
it "should consider the filters indexes have when determining equivalency" do
|
77
77
|
a = examine <<-SQL
|
78
78
|
CREATE TABLE test_table (
|
79
|
-
a integer
|
79
|
+
a integer,
|
80
|
+
b integer
|
80
81
|
);
|
81
82
|
|
82
|
-
CREATE INDEX int_idx ON test_table(a) WHERE
|
83
|
+
CREATE INDEX int_idx ON test_table(a) WHERE b > 0;
|
83
84
|
SQL
|
84
85
|
|
85
|
-
a.schemas.first.tables.first.indexes.first.row['filter'].should == '(
|
86
|
+
a.schemas.first.tables.first.indexes.first.row['filter'].should == '(b > 0)'
|
86
87
|
|
87
88
|
b = examine <<-SQL
|
88
89
|
CREATE TABLE test_table (
|
89
|
-
a integer
|
90
|
+
a integer,
|
91
|
+
b integer
|
90
92
|
);
|
91
93
|
|
92
|
-
CREATE INDEX int_idx ON test_table(a) WHERE
|
94
|
+
CREATE INDEX int_idx ON test_table(a) WHERE b > 0;
|
93
95
|
SQL
|
94
96
|
|
95
|
-
b.schemas.first.tables.first.indexes.first.row['filter'].should == '(
|
97
|
+
b.schemas.first.tables.first.indexes.first.row['filter'].should == '(b > 0)'
|
96
98
|
|
97
99
|
c = examine <<-SQL
|
98
100
|
CREATE TABLE test_table (
|
99
|
-
a integer
|
101
|
+
a integer,
|
102
|
+
b integer
|
100
103
|
);
|
101
104
|
|
102
105
|
CREATE INDEX int_idx ON test_table(a);
|
@@ -106,8 +109,8 @@ describe PGExaminer do
|
|
106
109
|
a.should_not == c
|
107
110
|
b.should_not == c
|
108
111
|
|
109
|
-
a.diff(c).should == {"schemas"=>{"public"=>{"tables"=>{"test_table"=>{"indexes"=>{"int_idx"=>{"filter expression"=>{"(
|
110
|
-
b.diff(c).should == {"schemas"=>{"public"=>{"tables"=>{"test_table"=>{"indexes"=>{"int_idx"=>{"filter expression"=>{"(
|
112
|
+
a.diff(c).should == {"schemas"=>{"public"=>{"tables"=>{"test_table"=>{"indexes"=>{"int_idx"=>{"filter expression"=>{"(b > 0)"=>nil}}}}}}}}
|
113
|
+
b.diff(c).should == {"schemas"=>{"public"=>{"tables"=>{"test_table"=>{"indexes"=>{"int_idx"=>{"filter expression"=>{"(b > 0)"=>nil}}}}}}}}
|
111
114
|
end
|
112
115
|
|
113
116
|
it "should consider the expressions indexes are on, if any" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_examiner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Hanks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|