pg_query 2.0.1 → 2.1.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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +220 -114
  3. data/README.md +12 -0
  4. data/Rakefile +6 -21
  5. data/ext/pg_query/extconf.rb +5 -2
  6. data/ext/pg_query/include/c.h +12 -0
  7. data/ext/pg_query/include/executor/executor.h +6 -0
  8. data/ext/pg_query/include/nodes/execnodes.h +9 -6
  9. data/ext/pg_query/include/nodes/pathnodes.h +1 -1
  10. data/ext/pg_query/include/optimizer/paths.h +8 -0
  11. data/ext/pg_query/include/pg_config.h +10 -6
  12. data/ext/pg_query/include/pg_config_manual.h +7 -0
  13. data/ext/pg_query/include/pg_query.h +2 -2
  14. data/ext/pg_query/include/pg_query_outfuncs_defs.c +1 -0
  15. data/ext/pg_query/include/pg_query_readfuncs_defs.c +1 -0
  16. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +472 -467
  17. data/ext/pg_query/include/protobuf-c/protobuf-c.h +7 -3
  18. data/ext/pg_query/include/protobuf-c.h +7 -3
  19. data/ext/pg_query/include/utils/array.h +1 -0
  20. data/ext/pg_query/include/utils/lsyscache.h +1 -0
  21. data/ext/pg_query/include/utils/probes.h +57 -57
  22. data/ext/pg_query/pg_query.pb-c.c +502 -487
  23. data/ext/pg_query/pg_query_deparse.c +33 -21
  24. data/ext/pg_query/pg_query_fingerprint.c +123 -33
  25. data/ext/pg_query/pg_query_fingerprint.h +3 -1
  26. data/ext/pg_query/pg_query_normalize.c +222 -61
  27. data/ext/pg_query/pg_query_parse_plpgsql.c +21 -1
  28. data/ext/pg_query/pg_query_ruby.sym +1 -0
  29. data/ext/pg_query/protobuf-c.c +34 -27
  30. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +36 -0
  31. data/ext/pg_query/src_common_hashfn.c +420 -0
  32. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1 -1
  33. data/lib/pg_query/filter_columns.rb +3 -1
  34. data/lib/pg_query/fingerprint.rb +1 -3
  35. data/lib/pg_query/parse.rb +101 -46
  36. data/lib/pg_query/pg_query_pb.rb +1385 -1383
  37. data/lib/pg_query/truncate.rb +12 -4
  38. data/lib/pg_query/version.rb +1 -1
  39. data/lib/pg_query.rb +0 -1
  40. metadata +8 -8
  41. data/lib/pg_query/json_field_names.rb +0 -1402
@@ -271,6 +271,12 @@ extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
271
271
  TupleTableSlot *slot,
272
272
  PlanState *parent,
273
273
  TupleDesc inputDesc);
274
+ extern ProjectionInfo *ExecBuildProjectionInfoExt(List *targetList,
275
+ ExprContext *econtext,
276
+ TupleTableSlot *slot,
277
+ bool assignJunkEntries,
278
+ PlanState *parent,
279
+ TupleDesc inputDesc);
274
280
  extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
275
281
  extern ExprState *ExecPrepareQual(List *qual, EState *estate);
276
282
  extern ExprState *ExecPrepareCheck(List *qual, EState *estate);
@@ -395,12 +395,15 @@ typedef struct OnConflictSetState
395
395
  * relation, and perhaps also fire triggers. ResultRelInfo holds all the
396
396
  * information needed about a result relation, including indexes.
397
397
  *
398
- * Normally, a ResultRelInfo refers to a table that is in the query's
399
- * range table; then ri_RangeTableIndex is the RT index and ri_RelationDesc
400
- * is just a copy of the relevant es_relations[] entry. But sometimes,
401
- * in ResultRelInfos used only for triggers, ri_RangeTableIndex is zero
402
- * and ri_RelationDesc is a separately-opened relcache pointer that needs
403
- * to be separately closed. See ExecGetTriggerResultRel.
398
+ * Normally, a ResultRelInfo refers to a table that is in the query's range
399
+ * table; then ri_RangeTableIndex is the RT index and ri_RelationDesc is
400
+ * just a copy of the relevant es_relations[] entry. However, in some
401
+ * situations we create ResultRelInfos for relations that are not in the
402
+ * range table, namely for targets of tuple routing in a partitioned table,
403
+ * and when firing triggers in tables other than the target tables (See
404
+ * ExecGetTriggerResultRel). In these situations, ri_RangeTableIndex is 0
405
+ * and ri_RelationDesc is a separately-opened relcache pointer that needs to
406
+ * be separately closed.
404
407
  */
405
408
  typedef struct ResultRelInfo
406
409
  {
@@ -912,7 +912,7 @@ typedef struct StatisticExtInfo
912
912
 
913
913
  Oid statOid; /* OID of the statistics row */
914
914
  RelOptInfo *rel; /* back-link to statistic's table */
915
- char kind; /* statistic kind of this entry */
915
+ char kind; /* statistics kind of this entry */
916
916
  Bitmapset *keys; /* attnums of the columns covered */
917
917
  } StatisticExtInfo;
918
918
 
@@ -135,6 +135,14 @@ extern EquivalenceClass *get_eclass_for_sort_expr(PlannerInfo *root,
135
135
  Index sortref,
136
136
  Relids rel,
137
137
  bool create_it);
138
+ extern EquivalenceMember *find_ec_member_matching_expr(EquivalenceClass *ec,
139
+ Expr *expr,
140
+ Relids relids);
141
+ extern EquivalenceMember *find_computable_ec_member(PlannerInfo *root,
142
+ EquivalenceClass *ec,
143
+ List *exprs,
144
+ Relids relids,
145
+ bool require_parallel_safe);
138
146
  extern Expr *find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel);
139
147
  extern Expr *find_em_expr_usable_for_sorting_rel(PlannerInfo *root,
140
148
  EquivalenceClass *ec,
@@ -757,7 +757,7 @@
757
757
  #define PACKAGE_NAME "PostgreSQL"
758
758
 
759
759
  /* Define to the full name and version of this package. */
760
- #define PACKAGE_STRING "PostgreSQL 13.2"
760
+ #define PACKAGE_STRING "PostgreSQL 13.3"
761
761
 
762
762
  /* Define to the one symbol short name of this package. */
763
763
  #define PACKAGE_TARNAME "postgresql"
@@ -766,7 +766,7 @@
766
766
  #define PACKAGE_URL "https://www.postgresql.org/"
767
767
 
768
768
  /* Define to the version of this package. */
769
- #define PACKAGE_VERSION "13.2"
769
+ #define PACKAGE_VERSION "13.3"
770
770
 
771
771
  /* Define to the name of a signed 128-bit integer type. */
772
772
  #define PG_INT128_TYPE __int128
@@ -785,7 +785,7 @@
785
785
  #define PG_MAJORVERSION_NUM 13
786
786
 
787
787
  /* PostgreSQL minor version number */
788
- #define PG_MINORVERSION_NUM 2
788
+ #define PG_MINORVERSION_NUM 3
789
789
 
790
790
  /* Define to best printf format archetype, usually gnu_printf if available. */
791
791
  #define PG_PRINTF_ATTRIBUTE printf
@@ -794,13 +794,13 @@
794
794
  #define PG_USE_STDBOOL 1
795
795
 
796
796
  /* PostgreSQL version as a string */
797
- #define PG_VERSION "13.2"
797
+ #define PG_VERSION "13.3"
798
798
 
799
799
  /* PostgreSQL version as a number */
800
- #define PG_VERSION_NUM 130002
800
+ #define PG_VERSION_NUM 130003
801
801
 
802
802
  /* A string containing the version number, platform, and C compiler */
803
- #define PG_VERSION_STR "PostgreSQL 13.2 on x86_64-apple-darwin19.6.0, compiled by Apple clang version 12.0.0 (clang-1200.0.32.29), 64-bit"
803
+ #define PG_VERSION_STR "PostgreSQL 13.3 on x86_64-apple-darwin19.6.0, compiled by Apple clang version 12.0.0 (clang-1200.0.32.29), 64-bit"
804
804
 
805
805
  /* Define to 1 to allow profiling output to be saved separately for each
806
806
  process. */
@@ -986,3 +986,7 @@
986
986
  #undef HAVE__STATIC_ASSERT
987
987
  #undef HAVE_EXECINFO_H
988
988
  #undef HAVE_BACKTRACE_SYMBOLS
989
+ #undef HAVE__GET_CPUID
990
+ #ifdef __FreeBSD__
991
+ #define HAVE_STRCHRNUL
992
+ #endif
@@ -135,6 +135,13 @@
135
135
  #define EXEC_BACKEND
136
136
  #endif
137
137
 
138
+ /*
139
+ * Define this if your operating system supports link()
140
+ */
141
+ #if !defined(WIN32) && !defined(__CYGWIN__)
142
+ #define HAVE_WORKING_LINK 1
143
+ #endif
144
+
138
145
  /*
139
146
  * USE_POSIX_FADVISE controls whether Postgres will attempt to use the
140
147
  * posix_fadvise() kernel call. Usually the automatic configure tests are
@@ -106,9 +106,9 @@ void pg_query_free_fingerprint_result(PgQueryFingerprintResult result);
106
106
  void pg_query_exit(void);
107
107
 
108
108
  // Postgres version information
109
- #define PG_VERSION "13.2"
109
+ #define PG_VERSION "13.3"
110
110
  #define PG_MAJORVERSION "13"
111
- #define PG_VERSION_NUM 130002
111
+ #define PG_VERSION_NUM 130003
112
112
 
113
113
  // Deprecated APIs below
114
114
 
@@ -2270,6 +2270,7 @@ _outTableLikeClause(OUT_TYPE(TableLikeClause, TableLikeClause) out, const TableL
2270
2270
  {
2271
2271
  WRITE_SPECIFIC_NODE_PTR_FIELD(RangeVar, range_var, relation, relation, relation);
2272
2272
  WRITE_UINT_FIELD(options, options, options);
2273
+ WRITE_UINT_FIELD(relation_oid, relationOid, relationOid);
2273
2274
  }
2274
2275
 
2275
2276
  static void
@@ -2674,6 +2674,7 @@ _readTableLikeClause(OUT_TYPE(TableLikeClause, TableLikeClause) msg)
2674
2674
  TableLikeClause *node = makeNode(TableLikeClause);
2675
2675
  READ_SPECIFIC_NODE_PTR_FIELD(RangeVar, range_var, relation, relation, relation);
2676
2676
  READ_UINT_FIELD(options, options, options);
2677
+ READ_UINT_FIELD(relation_oid, relationOid, relationOid);
2677
2678
  return node;
2678
2679
  }
2679
2680