pg_query 1.0.1 → 1.0.2

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: 4a5be9c84a9ac788a7845fc900696e4c7df77bb3
4
- data.tar.gz: e77d94ae2f8fb120c21efabf2faed451ad4e0966
3
+ metadata.gz: 9d1df6666392e194e8ac7a87086cae2e3051644a
4
+ data.tar.gz: b524259660a3489556696cf0f4b75d0c5c3c91b7
5
5
  SHA512:
6
- metadata.gz: 1f2f3fe149dfb181c7023fd243fa66f95f7613fffdb174c2968d947d37ade1d3dd15be599c27aa83ea67f8a289c8bff5e249c94902cb9fd61ca0306f61259927
7
- data.tar.gz: ae8f01f2afc0172fad220c3119fb48806893b8e49e5e35ab58448e2342161933487a5ba9cbae8d95c656c68f453537458b450529c72c12cc77119327494e7aa1
6
+ metadata.gz: 61523601794ef69a4dad8e33ba3fc9b5f35f299dce42f3b924b8ccca8726d9a11266dbcbbb7c1fc6f92c98c3443a02092d006c2c9a1484a1a9b9e0875fa9b6e3
7
+ data.tar.gz: 476105d1b4a3337f9ef4266452858cb70d02278ad8b564320ad9d76169425f81f2e64fc9fff070fcc9739ce3589bde93e5ea000bf062c61a7190d5f4e38eacee
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.2 2018-04-11
4
+
5
+ * Deparsing improvements
6
+ * SELECT DISTINCT clause [#77](https://github.com/lfittl/pg_query/pull/77) [@Papierkorb](https://github.com/Papierkorb)
7
+ * "CASE expr WHEN ... END" clause [#78](https://github.com/lfittl/pg_query/pull/78) [@Papierkorb](https://github.com/Papierkorb)
8
+ * LEFT/RIGHT/FULL/NATURAL JOIN [#79](https://github.com/lfittl/pg_query/pull/79) [@Papierkorb](https://github.com/Papierkorb)
9
+ * SELECT that includes schema name [#80](https://github.com/lfittl/pg_query/pull/80) [@jcsjcs](https://github.com/jcsjcs)
10
+
11
+
3
12
  ## 1.0.1 2018-02-02
4
13
 
5
14
  * Parse CTEs and nested selects in INSERT/UPDATE [#76](https://github.com/lfittl/pg_query/pull/76) [@jcoleman](https://github.com/jcoleman)
@@ -174,7 +174,8 @@ class PgQuery
174
174
  def deparse_rangevar(node)
175
175
  output = []
176
176
  output << 'ONLY' unless node['inh']
177
- output << '"' + node['relname'] + '"'
177
+ schema = node['schemaname'] ? '"' + node['schemaname'] + '".' : ''
178
+ output << schema + '"' + node['relname'] + '"'
178
179
  output << deparse_item(node['alias']) if node['alias']
179
180
  output.join(' ')
180
181
  end
@@ -432,9 +433,17 @@ class PgQuery
432
433
  output << deparse_item(node['larg'])
433
434
  case node['jointype']
434
435
  when 0
435
- output << 'CROSS' if node['quals'].nil? && node['usingClause'].nil?
436
+ if node['isNatural']
437
+ output << 'NATURAL'
438
+ elsif node['quals'].nil? && node['usingClause'].nil?
439
+ output << 'CROSS'
440
+ end
436
441
  when 1
437
442
  output << 'LEFT'
443
+ when 2
444
+ output << 'FULL'
445
+ when 3
446
+ output << 'RIGHT'
438
447
  end
439
448
  output << 'JOIN'
440
449
  output << deparse_item(node['rarg'])
@@ -528,6 +537,7 @@ class PgQuery
528
537
 
529
538
  def deparse_case(node)
530
539
  output = ['CASE']
540
+ output << deparse_item(node['arg']) if node['arg']
531
541
  output += node['args'].map { |arg| deparse_item(arg) }
532
542
  if node['defresult']
533
543
  output << 'ELSE'
@@ -681,6 +691,7 @@ class PgQuery
681
691
 
682
692
  if node[TARGET_LIST_FIELD]
683
693
  output << 'SELECT'
694
+ output << 'DISTINCT' if node['distinctClause']
684
695
  output << node[TARGET_LIST_FIELD].map do |item|
685
696
  deparse_item(item, :select)
686
697
  end.join(', ')
@@ -1,3 +1,3 @@
1
1
  class PgQuery
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Fittl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-02 00:00:00.000000000 Z
11
+ date: 2018-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.6.13
125
+ rubygems_version: 2.6.8
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: PostgreSQL query parsing and normalization library