pg_query 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/ext/pg_query/extconf.rb +3 -7
- data/lib/pg_query/deparse.rb +27 -1
- data/lib/pg_query/version.rb +1 -1
- 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: 2d7e7317e7c022454158d1f8d78a32e2b38fcd6b
|
4
|
+
data.tar.gz: b123e3e645343e4749520ba80a0efd55f67d9c40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c010e9fd04c3546c6351576dea74a18706070a2441e3c550d69a32df2e5c070e287d8ffa2d13e8b06c8e779cb480f55a803327fa3fed9339b4f55d98bbf4b446
|
7
|
+
data.tar.gz: 092abe2df76fd405523a4bfe5638b5d7b8bb03106cae55ae2b7afacae8e4508b8b4c32a5e7ad90e0c51eaa6c37ef6b804771f7bc9854aa6178d32b681de1bb29
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.10.0 2016-05-31
|
4
|
+
|
5
|
+
* Based on PostgreSQL 9.5.3
|
6
|
+
* Use LLVM extracted parser for significantly improved build times (via libpg_query)
|
7
|
+
* Deparsing Improvements
|
8
|
+
* SET statements [#48](https://github.com/lfittl/pg_query/pull/48) [@Winslett](https://github.com/Winslett)
|
9
|
+
* LIKE/NOT LIKE [#49](https://github.com/lfittl/pg_query/pull/49) [@Winslett](https://github.com/Winslett)
|
10
|
+
* CREATE FUNCTION improvements [#50](https://github.com/lfittl/pg_query/pull/50) [@Winslett](https://github.com/Winslett)
|
11
|
+
|
12
|
+
|
3
13
|
## 0.9.2 2016-05-03
|
4
14
|
|
5
15
|
* Fix issue with A_CONST string values in `.parsetree` compatibility layer (Fixes [#47](https://github.com/lfittl/pg_query/issues/47))
|
data/ext/pg_query/extconf.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'mkmf'
|
4
4
|
require 'open-uri'
|
5
5
|
|
6
|
-
LIB_PG_QUERY_TAG = '9.5-1.
|
6
|
+
LIB_PG_QUERY_TAG = '9.5-1.3.0'
|
7
7
|
|
8
8
|
workdir = Dir.pwd
|
9
9
|
libdir = File.join(workdir, 'libpg_query-' + LIB_PG_QUERY_TAG)
|
@@ -24,11 +24,7 @@ end
|
|
24
24
|
|
25
25
|
unless Dir.exist?(libfile)
|
26
26
|
# Build libpg_query (and parts of PostgreSQL)
|
27
|
-
system("cd #{libdir}; make
|
28
|
-
|
29
|
-
# Cleanup the Postgres install inside libpg_query to reduce the installed size
|
30
|
-
system("rm -rf #{libdir}/postgres")
|
31
|
-
system("rm -f #{libdir}/postgres.tar.bz2")
|
27
|
+
system("cd #{libdir}; make build")
|
32
28
|
end
|
33
29
|
|
34
30
|
# Copy test files (this intentionally overwrites existing files!)
|
@@ -38,7 +34,7 @@ $objs = ['pg_query_ruby.o']
|
|
38
34
|
|
39
35
|
$LOCAL_LIBS << '-lpg_query'
|
40
36
|
$LIBPATH << libdir
|
41
|
-
$CFLAGS << " -I #{libdir} -O3 -Wall -
|
37
|
+
$CFLAGS << " -I #{libdir} -O3 -Wall -fno-strict-aliasing -fwrapv"
|
42
38
|
|
43
39
|
SYMFILE = File.join(File.dirname(__FILE__), 'pg_query_ruby.sym')
|
44
40
|
if RUBY_PLATFORM =~ /darwin/
|
data/lib/pg_query/deparse.rb
CHANGED
@@ -36,6 +36,8 @@ class PgQuery
|
|
36
36
|
deparse_aexpr_any(node)
|
37
37
|
when AEXPR_IN
|
38
38
|
deparse_aexpr_in(node)
|
39
|
+
when CONSTR_TYPE_FOREIGN
|
40
|
+
deparse_aexpr_like(node)
|
39
41
|
else
|
40
42
|
fail format("Can't deparse: %s: %s", type, node.inspect)
|
41
43
|
end
|
@@ -136,6 +138,8 @@ class PgQuery
|
|
136
138
|
deparse_with_clause(node)
|
137
139
|
when VIEW_STMT
|
138
140
|
deparse_viewstmt(node)
|
141
|
+
when VARIABLE_SET_STMT
|
142
|
+
deparse_variable_set_stmt(node)
|
139
143
|
when STRING
|
140
144
|
if context == A_CONST
|
141
145
|
format("'%s'", node['str'].gsub("'", "''"))
|
@@ -312,6 +316,12 @@ class PgQuery
|
|
312
316
|
format('%s %s (%s)', deparse_item(node['lexpr']), operator, rexpr.join(', '))
|
313
317
|
end
|
314
318
|
|
319
|
+
def deparse_aexpr_like(node)
|
320
|
+
value = deparse_item(node['rexpr'])
|
321
|
+
operator = node['name'].map { |n| deparse_item(n, :operator) } == ['~~'] ? 'LIKE' : 'NOT LIKE'
|
322
|
+
format('%s %s %s', deparse_item(node['lexpr']), operator, value)
|
323
|
+
end
|
324
|
+
|
315
325
|
def deparse_bool_expr_not(node)
|
316
326
|
format('NOT %s', deparse_item(node['args'][0]))
|
317
327
|
end
|
@@ -440,6 +450,16 @@ class PgQuery
|
|
440
450
|
output.join(' ')
|
441
451
|
end
|
442
452
|
|
453
|
+
def deparse_variable_set_stmt(node)
|
454
|
+
output = []
|
455
|
+
output << 'SET'
|
456
|
+
output << 'LOCAL' if node['is_local']
|
457
|
+
output << node['name']
|
458
|
+
output << 'TO'
|
459
|
+
output << node['args'].map { |arg| deparse_item(arg) }.join(', ')
|
460
|
+
output.join(' ')
|
461
|
+
end
|
462
|
+
|
443
463
|
def deparse_cte(node)
|
444
464
|
output = []
|
445
465
|
output << node['ctename']
|
@@ -512,7 +532,9 @@ class PgQuery
|
|
512
532
|
|
513
533
|
def deparse_create_function(node)
|
514
534
|
output = []
|
515
|
-
output << 'CREATE
|
535
|
+
output << 'CREATE'
|
536
|
+
output << 'OR REPLACE' if node['replace']
|
537
|
+
output << 'FUNCTION'
|
516
538
|
|
517
539
|
arguments = deparse_item_list(node['parameters']).join(', ')
|
518
540
|
|
@@ -836,6 +858,10 @@ class PgQuery
|
|
836
858
|
"AS $$#{deparse_item_list(node['arg'], :defname_as).join("\n")}$$"
|
837
859
|
when 'language'
|
838
860
|
"language #{deparse_item(node['arg'])}"
|
861
|
+
when 'volatility'
|
862
|
+
node['arg']['String']['str'].upcase # volatility does not need to be quoted
|
863
|
+
when 'strict'
|
864
|
+
deparse_item(node['arg']) == '1' ? 'RETURNS NULL ON NULL INPUT' : 'CALLED ON NULL INPUT'
|
839
865
|
else
|
840
866
|
deparse_item(node['arg'])
|
841
867
|
end
|
data/lib/pg_query/version.rb
CHANGED
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: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Fittl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|