pg_query 6.1.0 → 6.2.1
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 +38 -1
- data/README.md +1 -1
- data/Rakefile +3 -2
- data/ext/pg_query/extconf.rb +2 -2
- data/ext/pg_query/include/pg_query.h +32 -2
- data/ext/pg_query/include/postgres/access/amapi.h +1 -1
- data/ext/pg_query/include/postgres/access/slru.h +1 -1
- data/ext/pg_query/include/postgres/access/tableam.h +11 -4
- data/ext/pg_query/include/postgres/access/xlog.h +1 -0
- data/ext/pg_query/include/postgres/access/xlogdefs.h +2 -1
- data/ext/pg_query/include/postgres/commands/defrem.h +1 -1
- data/ext/pg_query/include/postgres/commands/trigger.h +18 -0
- data/ext/pg_query/include/postgres/executor/executor.h +4 -0
- data/ext/pg_query/include/postgres/mb/pg_wchar.h +2 -0
- data/ext/pg_query/include/postgres/miscadmin.h +2 -1
- data/ext/pg_query/include/postgres/nodes/execnodes.h +6 -8
- data/ext/pg_query/include/postgres/nodes/pathnodes.h +1 -2
- data/ext/pg_query/include/postgres/pg_config.h +10 -9
- data/ext/pg_query/include/postgres/pg_config_manual.h +2 -0
- data/ext/pg_query/include/postgres/port/atomics/generic-gcc.h +10 -2
- data/ext/pg_query/include/postgres/port/pg_iovec.h +9 -3
- data/ext/pg_query/include/postgres/replication/reorderbuffer.h +29 -9
- data/ext/pg_query/include/postgres/replication/slot.h +2 -0
- data/ext/pg_query/include/postgres/utils/elog.h +1 -0
- data/ext/pg_query/include/postgres/utils/guc.h +1 -1
- data/ext/pg_query/include/postgres/utils/guc_hooks.h +0 -2
- data/ext/pg_query/include/postgres/utils/pg_locale.h +5 -0
- data/ext/pg_query/include/postgres_deparse.h +34 -0
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +673 -516
- data/ext/pg_query/pg_query.pb-c.c +488 -0
- data/ext/pg_query/pg_query_deparse.c +148 -15
- data/ext/pg_query/pg_query_internal.h +9 -8
- data/ext/pg_query/pg_query_is_utility_stmt.c +70 -0
- data/ext/pg_query/pg_query_normalize.c +3 -0
- data/ext/pg_query/pg_query_raw_tree_walker_supports.c +117 -0
- data/ext/pg_query/pg_query_ruby.c +150 -0
- data/ext/pg_query/pg_query_summary.c +941 -0
- data/ext/pg_query/pg_query_summary.h +109 -0
- data/ext/pg_query/pg_query_summary_statement_type.c +797 -0
- data/ext/pg_query/pg_query_summary_truncate.c +530 -0
- data/ext/pg_query/postgres_deparse.c +4481 -3870
- data/ext/pg_query/src_backend_catalog_namespace.c +29 -0
- data/ext/pg_query/src_backend_nodes_bitmapset.c +84 -1
- data/ext/pg_query/src_backend_nodes_list.c +60 -1
- data/ext/pg_query/src_backend_parser_gram.c +739 -732
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +2 -2
- data/ext/pg_query/src_backend_utils_error_elog.c +11 -0
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +43 -4
- data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +22 -7
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +3 -3
- data/ext/pg_query/src_backend_utils_mmgr_bump.c +1 -1
- data/ext/pg_query/src_common_stringinfo.c +20 -0
- data/ext/pg_query/src_common_wchar.c +46 -6
- data/lib/pg_query/deparse.rb +29 -8
- data/lib/pg_query/parse.rb +19 -0
- data/lib/pg_query/pg_query_pb.rb +7 -2
- data/lib/pg_query/split.rb +20 -0
- data/lib/pg_query/treewalker.rb +9 -7
- data/lib/pg_query/version.rb +1 -1
- data/lib/pg_query.rb +1 -0
- metadata +10 -3
- data/ext/pg_query/postgres_deparse.h +0 -9
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module PgQuery
|
|
2
|
+
class SplitError < ArgumentError
|
|
3
|
+
attr_reader :location
|
|
4
|
+
|
|
5
|
+
def initialize(message, source_file, source_line, location)
|
|
6
|
+
super("#{message} (#{source_file}:#{source_line})")
|
|
7
|
+
@location = location
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.split_with_parser(query)
|
|
12
|
+
result, stderr = _raw_split_with_parser(query)
|
|
13
|
+
|
|
14
|
+
raise SplitError.new(stderr, 'stderr', '', '') unless stderr.empty?
|
|
15
|
+
|
|
16
|
+
result.map do |location, len|
|
|
17
|
+
query[location..location + len]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/pg_query/treewalker.rb
CHANGED
|
@@ -17,6 +17,15 @@ module PgQuery
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# Traverses the tree to find the node at the given location and yields
|
|
21
|
+
# its parent node, the parent field, and the node itself.
|
|
22
|
+
def find_tree_location(tree, searched_location)
|
|
23
|
+
treewalker_with_location! tree do |parent_node, parent_field, node, location|
|
|
24
|
+
next unless location == searched_location
|
|
25
|
+
yield(parent_node, parent_field, node)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
20
29
|
private
|
|
21
30
|
|
|
22
31
|
def treewalker!(tree) # rubocop:disable Metrics/CyclomaticComplexity
|
|
@@ -73,12 +82,5 @@ module PgQuery
|
|
|
73
82
|
break if nodes.empty?
|
|
74
83
|
end
|
|
75
84
|
end
|
|
76
|
-
|
|
77
|
-
def find_tree_location(tree, searched_location)
|
|
78
|
-
treewalker_with_location! tree do |parent_node, parent_field, node, location|
|
|
79
|
-
next unless location == searched_location
|
|
80
|
-
yield(parent_node, parent_field, node)
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
85
|
end
|
|
84
86
|
end
|
data/lib/pg_query/version.rb
CHANGED
data/lib/pg_query.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: 6.1
|
|
4
|
+
version: 6.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lukas Fittl
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: google-protobuf
|
|
@@ -473,6 +473,7 @@ files:
|
|
|
473
473
|
- ext/pg_query/include/postgres/utils/wait_event_types.h
|
|
474
474
|
- ext/pg_query/include/postgres/utils/xml.h
|
|
475
475
|
- ext/pg_query/include/postgres/varatt.h
|
|
476
|
+
- ext/pg_query/include/postgres_deparse.h
|
|
476
477
|
- ext/pg_query/include/protobuf-c.h
|
|
477
478
|
- ext/pg_query/include/protobuf-c/protobuf-c.h
|
|
478
479
|
- ext/pg_query/include/protobuf/pg_query.pb-c.h
|
|
@@ -485,6 +486,7 @@ files:
|
|
|
485
486
|
- ext/pg_query/pg_query_fingerprint.c
|
|
486
487
|
- ext/pg_query/pg_query_fingerprint.h
|
|
487
488
|
- ext/pg_query/pg_query_internal.h
|
|
489
|
+
- ext/pg_query/pg_query_is_utility_stmt.c
|
|
488
490
|
- ext/pg_query/pg_query_json_plpgsql.c
|
|
489
491
|
- ext/pg_query/pg_query_json_plpgsql.h
|
|
490
492
|
- ext/pg_query/pg_query_normalize.c
|
|
@@ -493,13 +495,17 @@ files:
|
|
|
493
495
|
- ext/pg_query/pg_query_outfuncs_protobuf.c
|
|
494
496
|
- ext/pg_query/pg_query_parse.c
|
|
495
497
|
- ext/pg_query/pg_query_parse_plpgsql.c
|
|
498
|
+
- ext/pg_query/pg_query_raw_tree_walker_supports.c
|
|
496
499
|
- ext/pg_query/pg_query_readfuncs.h
|
|
497
500
|
- ext/pg_query/pg_query_readfuncs_protobuf.c
|
|
498
501
|
- ext/pg_query/pg_query_ruby.c
|
|
499
502
|
- ext/pg_query/pg_query_scan.c
|
|
500
503
|
- ext/pg_query/pg_query_split.c
|
|
504
|
+
- ext/pg_query/pg_query_summary.c
|
|
505
|
+
- ext/pg_query/pg_query_summary.h
|
|
506
|
+
- ext/pg_query/pg_query_summary_statement_type.c
|
|
507
|
+
- ext/pg_query/pg_query_summary_truncate.c
|
|
501
508
|
- ext/pg_query/postgres_deparse.c
|
|
502
|
-
- ext/pg_query/postgres_deparse.h
|
|
503
509
|
- ext/pg_query/protobuf-c.c
|
|
504
510
|
- ext/pg_query/src_backend_catalog_namespace.c
|
|
505
511
|
- ext/pg_query/src_backend_catalog_pg_proc.c
|
|
@@ -569,6 +575,7 @@ files:
|
|
|
569
575
|
- lib/pg_query/parse_error.rb
|
|
570
576
|
- lib/pg_query/pg_query_pb.rb
|
|
571
577
|
- lib/pg_query/scan.rb
|
|
578
|
+
- lib/pg_query/split.rb
|
|
572
579
|
- lib/pg_query/treewalker.rb
|
|
573
580
|
- lib/pg_query/truncate.rb
|
|
574
581
|
- lib/pg_query/version.rb
|