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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -1
  3. data/README.md +1 -1
  4. data/Rakefile +3 -2
  5. data/ext/pg_query/extconf.rb +2 -2
  6. data/ext/pg_query/include/pg_query.h +32 -2
  7. data/ext/pg_query/include/postgres/access/amapi.h +1 -1
  8. data/ext/pg_query/include/postgres/access/slru.h +1 -1
  9. data/ext/pg_query/include/postgres/access/tableam.h +11 -4
  10. data/ext/pg_query/include/postgres/access/xlog.h +1 -0
  11. data/ext/pg_query/include/postgres/access/xlogdefs.h +2 -1
  12. data/ext/pg_query/include/postgres/commands/defrem.h +1 -1
  13. data/ext/pg_query/include/postgres/commands/trigger.h +18 -0
  14. data/ext/pg_query/include/postgres/executor/executor.h +4 -0
  15. data/ext/pg_query/include/postgres/mb/pg_wchar.h +2 -0
  16. data/ext/pg_query/include/postgres/miscadmin.h +2 -1
  17. data/ext/pg_query/include/postgres/nodes/execnodes.h +6 -8
  18. data/ext/pg_query/include/postgres/nodes/pathnodes.h +1 -2
  19. data/ext/pg_query/include/postgres/pg_config.h +10 -9
  20. data/ext/pg_query/include/postgres/pg_config_manual.h +2 -0
  21. data/ext/pg_query/include/postgres/port/atomics/generic-gcc.h +10 -2
  22. data/ext/pg_query/include/postgres/port/pg_iovec.h +9 -3
  23. data/ext/pg_query/include/postgres/replication/reorderbuffer.h +29 -9
  24. data/ext/pg_query/include/postgres/replication/slot.h +2 -0
  25. data/ext/pg_query/include/postgres/utils/elog.h +1 -0
  26. data/ext/pg_query/include/postgres/utils/guc.h +1 -1
  27. data/ext/pg_query/include/postgres/utils/guc_hooks.h +0 -2
  28. data/ext/pg_query/include/postgres/utils/pg_locale.h +5 -0
  29. data/ext/pg_query/include/postgres_deparse.h +34 -0
  30. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +673 -516
  31. data/ext/pg_query/pg_query.pb-c.c +488 -0
  32. data/ext/pg_query/pg_query_deparse.c +148 -15
  33. data/ext/pg_query/pg_query_internal.h +9 -8
  34. data/ext/pg_query/pg_query_is_utility_stmt.c +70 -0
  35. data/ext/pg_query/pg_query_normalize.c +3 -0
  36. data/ext/pg_query/pg_query_raw_tree_walker_supports.c +117 -0
  37. data/ext/pg_query/pg_query_ruby.c +150 -0
  38. data/ext/pg_query/pg_query_summary.c +941 -0
  39. data/ext/pg_query/pg_query_summary.h +109 -0
  40. data/ext/pg_query/pg_query_summary_statement_type.c +797 -0
  41. data/ext/pg_query/pg_query_summary_truncate.c +530 -0
  42. data/ext/pg_query/postgres_deparse.c +4481 -3870
  43. data/ext/pg_query/src_backend_catalog_namespace.c +29 -0
  44. data/ext/pg_query/src_backend_nodes_bitmapset.c +84 -1
  45. data/ext/pg_query/src_backend_nodes_list.c +60 -1
  46. data/ext/pg_query/src_backend_parser_gram.c +739 -732
  47. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +2 -2
  48. data/ext/pg_query/src_backend_utils_error_elog.c +11 -0
  49. data/ext/pg_query/src_backend_utils_mb_mbutils.c +43 -4
  50. data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +22 -7
  51. data/ext/pg_query/src_backend_utils_mmgr_aset.c +3 -3
  52. data/ext/pg_query/src_backend_utils_mmgr_bump.c +1 -1
  53. data/ext/pg_query/src_common_stringinfo.c +20 -0
  54. data/ext/pg_query/src_common_wchar.c +46 -6
  55. data/lib/pg_query/deparse.rb +29 -8
  56. data/lib/pg_query/parse.rb +19 -0
  57. data/lib/pg_query/pg_query_pb.rb +7 -2
  58. data/lib/pg_query/split.rb +20 -0
  59. data/lib/pg_query/treewalker.rb +9 -7
  60. data/lib/pg_query/version.rb +1 -1
  61. data/lib/pg_query.rb +1 -0
  62. metadata +10 -3
  63. data/ext/pg_query/postgres_deparse.h +0 -9
@@ -0,0 +1,34 @@
1
+ #ifndef POSTGRES_DEPARSE_H
2
+ #define POSTGRES_DEPARSE_H
3
+
4
+ #include <stdbool.h>
5
+ #include <sys/types.h>
6
+
7
+ typedef struct PostgresDeparseComment {
8
+ int match_location; // Insert comment before a node, once we find a node whose location field is equal-or-higher than this location
9
+ int newlines_before_comment; // Insert newlines before inserting the comment (set to non-zero if the source comment was separated from the prior token by at least one newline)
10
+ int newlines_after_comment; // Insert newlines after inserting the comment (set to non-zero if the source comment was separated from the next token by at least one newline)
11
+ char *str; // The actual comment string, including comment start/end tokens, and newline characters in comment (if any)
12
+ } PostgresDeparseComment;
13
+
14
+ typedef struct PostgresDeparseOpts {
15
+ PostgresDeparseComment **comments;
16
+ size_t comment_count;
17
+
18
+ // Pretty print options
19
+ bool pretty_print;
20
+ int indent_size; // Indentation size (Default 4 spaces)
21
+ int max_line_length; // Restricts the line length of certain lists of items (Default 80 characters)
22
+ bool trailing_newline; // Whether to add a trailing newline at the end of the output (Default off)
23
+ bool commas_start_of_line; // Place separating commas at start of line (Default off)
24
+ } PostgresDeparseOpts;
25
+
26
+ /* Forward declarations to allow referencing the structs in this include file without needing Postgres includes */
27
+ struct StringInfoData;
28
+ typedef struct StringInfoData *StringInfo;
29
+ struct RawStmt;
30
+
31
+ extern void deparseRawStmt(StringInfo str, struct RawStmt *raw_stmt);
32
+ extern void deparseRawStmtOpts(StringInfo str, struct RawStmt *raw_stmt, PostgresDeparseOpts opts);
33
+
34
+ #endif