pg_query 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (375) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/ext/pg_query/include/access/amapi.h +246 -0
  4. data/ext/pg_query/include/access/attmap.h +52 -0
  5. data/ext/pg_query/include/access/attnum.h +64 -0
  6. data/ext/pg_query/include/access/clog.h +61 -0
  7. data/ext/pg_query/include/access/commit_ts.h +77 -0
  8. data/ext/pg_query/include/access/detoast.h +92 -0
  9. data/ext/pg_query/include/access/genam.h +228 -0
  10. data/ext/pg_query/include/access/gin.h +78 -0
  11. data/ext/pg_query/include/access/htup.h +89 -0
  12. data/ext/pg_query/include/access/htup_details.h +819 -0
  13. data/ext/pg_query/include/access/itup.h +161 -0
  14. data/ext/pg_query/include/access/parallel.h +82 -0
  15. data/ext/pg_query/include/access/printtup.h +35 -0
  16. data/ext/pg_query/include/access/relation.h +28 -0
  17. data/ext/pg_query/include/access/relscan.h +176 -0
  18. data/ext/pg_query/include/access/rmgr.h +35 -0
  19. data/ext/pg_query/include/access/rmgrlist.h +49 -0
  20. data/ext/pg_query/include/access/sdir.h +58 -0
  21. data/ext/pg_query/include/access/skey.h +151 -0
  22. data/ext/pg_query/include/access/stratnum.h +83 -0
  23. data/ext/pg_query/include/access/sysattr.h +29 -0
  24. data/ext/pg_query/include/access/table.h +27 -0
  25. data/ext/pg_query/include/access/tableam.h +1825 -0
  26. data/ext/pg_query/include/access/transam.h +265 -0
  27. data/ext/pg_query/include/access/tupconvert.h +51 -0
  28. data/ext/pg_query/include/access/tupdesc.h +154 -0
  29. data/ext/pg_query/include/access/tupmacs.h +247 -0
  30. data/ext/pg_query/include/access/twophase.h +61 -0
  31. data/ext/pg_query/include/access/xact.h +463 -0
  32. data/ext/pg_query/include/access/xlog.h +398 -0
  33. data/ext/pg_query/include/access/xlog_internal.h +330 -0
  34. data/ext/pg_query/include/access/xlogdefs.h +109 -0
  35. data/ext/pg_query/include/access/xloginsert.h +64 -0
  36. data/ext/pg_query/include/access/xlogreader.h +327 -0
  37. data/ext/pg_query/include/access/xlogrecord.h +227 -0
  38. data/ext/pg_query/include/bootstrap/bootstrap.h +62 -0
  39. data/ext/pg_query/include/c.h +1322 -0
  40. data/ext/pg_query/include/catalog/catalog.h +42 -0
  41. data/ext/pg_query/include/catalog/catversion.h +58 -0
  42. data/ext/pg_query/include/catalog/dependency.h +275 -0
  43. data/ext/pg_query/include/catalog/genbki.h +64 -0
  44. data/ext/pg_query/include/catalog/index.h +199 -0
  45. data/ext/pg_query/include/catalog/indexing.h +366 -0
  46. data/ext/pg_query/include/catalog/namespace.h +188 -0
  47. data/ext/pg_query/include/catalog/objectaccess.h +197 -0
  48. data/ext/pg_query/include/catalog/objectaddress.h +84 -0
  49. data/ext/pg_query/include/catalog/pg_aggregate.h +176 -0
  50. data/ext/pg_query/include/catalog/pg_aggregate_d.h +77 -0
  51. data/ext/pg_query/include/catalog/pg_am.h +60 -0
  52. data/ext/pg_query/include/catalog/pg_am_d.h +45 -0
  53. data/ext/pg_query/include/catalog/pg_attribute.h +204 -0
  54. data/ext/pg_query/include/catalog/pg_attribute_d.h +59 -0
  55. data/ext/pg_query/include/catalog/pg_authid.h +58 -0
  56. data/ext/pg_query/include/catalog/pg_authid_d.h +49 -0
  57. data/ext/pg_query/include/catalog/pg_class.h +200 -0
  58. data/ext/pg_query/include/catalog/pg_class_d.h +103 -0
  59. data/ext/pg_query/include/catalog/pg_collation.h +73 -0
  60. data/ext/pg_query/include/catalog/pg_collation_d.h +45 -0
  61. data/ext/pg_query/include/catalog/pg_constraint.h +247 -0
  62. data/ext/pg_query/include/catalog/pg_constraint_d.h +67 -0
  63. data/ext/pg_query/include/catalog/pg_control.h +250 -0
  64. data/ext/pg_query/include/catalog/pg_conversion.h +72 -0
  65. data/ext/pg_query/include/catalog/pg_conversion_d.h +35 -0
  66. data/ext/pg_query/include/catalog/pg_depend.h +73 -0
  67. data/ext/pg_query/include/catalog/pg_depend_d.h +34 -0
  68. data/ext/pg_query/include/catalog/pg_event_trigger.h +51 -0
  69. data/ext/pg_query/include/catalog/pg_event_trigger_d.h +34 -0
  70. data/ext/pg_query/include/catalog/pg_index.h +80 -0
  71. data/ext/pg_query/include/catalog/pg_index_d.h +56 -0
  72. data/ext/pg_query/include/catalog/pg_language.h +67 -0
  73. data/ext/pg_query/include/catalog/pg_language_d.h +39 -0
  74. data/ext/pg_query/include/catalog/pg_namespace.h +59 -0
  75. data/ext/pg_query/include/catalog/pg_namespace_d.h +34 -0
  76. data/ext/pg_query/include/catalog/pg_opclass.h +85 -0
  77. data/ext/pg_query/include/catalog/pg_opclass_d.h +49 -0
  78. data/ext/pg_query/include/catalog/pg_operator.h +102 -0
  79. data/ext/pg_query/include/catalog/pg_operator_d.h +106 -0
  80. data/ext/pg_query/include/catalog/pg_opfamily.h +60 -0
  81. data/ext/pg_query/include/catalog/pg_opfamily_d.h +47 -0
  82. data/ext/pg_query/include/catalog/pg_partitioned_table.h +63 -0
  83. data/ext/pg_query/include/catalog/pg_partitioned_table_d.h +35 -0
  84. data/ext/pg_query/include/catalog/pg_proc.h +211 -0
  85. data/ext/pg_query/include/catalog/pg_proc_d.h +99 -0
  86. data/ext/pg_query/include/catalog/pg_publication.h +115 -0
  87. data/ext/pg_query/include/catalog/pg_publication_d.h +36 -0
  88. data/ext/pg_query/include/catalog/pg_replication_origin.h +57 -0
  89. data/ext/pg_query/include/catalog/pg_replication_origin_d.h +29 -0
  90. data/ext/pg_query/include/catalog/pg_statistic.h +275 -0
  91. data/ext/pg_query/include/catalog/pg_statistic_d.h +194 -0
  92. data/ext/pg_query/include/catalog/pg_statistic_ext.h +74 -0
  93. data/ext/pg_query/include/catalog/pg_statistic_ext_d.h +40 -0
  94. data/ext/pg_query/include/catalog/pg_transform.h +45 -0
  95. data/ext/pg_query/include/catalog/pg_transform_d.h +32 -0
  96. data/ext/pg_query/include/catalog/pg_trigger.h +137 -0
  97. data/ext/pg_query/include/catalog/pg_trigger_d.h +106 -0
  98. data/ext/pg_query/include/catalog/pg_ts_config.h +50 -0
  99. data/ext/pg_query/include/catalog/pg_ts_config_d.h +32 -0
  100. data/ext/pg_query/include/catalog/pg_ts_dict.h +54 -0
  101. data/ext/pg_query/include/catalog/pg_ts_dict_d.h +33 -0
  102. data/ext/pg_query/include/catalog/pg_ts_parser.h +57 -0
  103. data/ext/pg_query/include/catalog/pg_ts_parser_d.h +35 -0
  104. data/ext/pg_query/include/catalog/pg_ts_template.h +48 -0
  105. data/ext/pg_query/include/catalog/pg_ts_template_d.h +32 -0
  106. data/ext/pg_query/include/catalog/pg_type.h +372 -0
  107. data/ext/pg_query/include/catalog/pg_type_d.h +285 -0
  108. data/ext/pg_query/include/catalog/storage.h +48 -0
  109. data/ext/pg_query/include/commands/async.h +54 -0
  110. data/ext/pg_query/include/commands/dbcommands.h +35 -0
  111. data/ext/pg_query/include/commands/defrem.h +173 -0
  112. data/ext/pg_query/include/commands/event_trigger.h +88 -0
  113. data/ext/pg_query/include/commands/explain.h +127 -0
  114. data/ext/pg_query/include/commands/prepare.h +61 -0
  115. data/ext/pg_query/include/commands/tablespace.h +67 -0
  116. data/ext/pg_query/include/commands/trigger.h +277 -0
  117. data/ext/pg_query/include/commands/user.h +37 -0
  118. data/ext/pg_query/include/commands/vacuum.h +293 -0
  119. data/ext/pg_query/include/commands/variable.h +38 -0
  120. data/ext/pg_query/include/common/file_perm.h +56 -0
  121. data/ext/pg_query/include/common/hashfn.h +104 -0
  122. data/ext/pg_query/include/common/ip.h +37 -0
  123. data/ext/pg_query/include/common/keywords.h +33 -0
  124. data/ext/pg_query/include/common/kwlookup.h +44 -0
  125. data/ext/pg_query/include/common/relpath.h +90 -0
  126. data/ext/pg_query/include/common/string.h +19 -0
  127. data/ext/pg_query/include/common/unicode_combining_table.h +196 -0
  128. data/ext/pg_query/include/datatype/timestamp.h +197 -0
  129. data/ext/pg_query/include/executor/execdesc.h +70 -0
  130. data/ext/pg_query/include/executor/executor.h +614 -0
  131. data/ext/pg_query/include/executor/functions.h +41 -0
  132. data/ext/pg_query/include/executor/instrument.h +101 -0
  133. data/ext/pg_query/include/executor/spi.h +175 -0
  134. data/ext/pg_query/include/executor/tablefunc.h +67 -0
  135. data/ext/pg_query/include/executor/tuptable.h +487 -0
  136. data/ext/pg_query/include/fmgr.h +775 -0
  137. data/ext/pg_query/include/funcapi.h +348 -0
  138. data/ext/pg_query/include/getaddrinfo.h +162 -0
  139. data/ext/pg_query/include/jit/jit.h +105 -0
  140. data/ext/pg_query/include/kwlist_d.h +1072 -0
  141. data/ext/pg_query/include/lib/ilist.h +727 -0
  142. data/ext/pg_query/include/lib/pairingheap.h +102 -0
  143. data/ext/pg_query/include/lib/simplehash.h +1059 -0
  144. data/ext/pg_query/include/lib/stringinfo.h +161 -0
  145. data/ext/pg_query/include/libpq/auth.h +29 -0
  146. data/ext/pg_query/include/libpq/crypt.h +46 -0
  147. data/ext/pg_query/include/libpq/hba.h +140 -0
  148. data/ext/pg_query/include/libpq/libpq-be.h +326 -0
  149. data/ext/pg_query/include/libpq/libpq.h +133 -0
  150. data/ext/pg_query/include/libpq/pqcomm.h +208 -0
  151. data/ext/pg_query/include/libpq/pqformat.h +210 -0
  152. data/ext/pg_query/include/libpq/pqsignal.h +42 -0
  153. data/ext/pg_query/include/mb/pg_wchar.h +672 -0
  154. data/ext/pg_query/include/mb/stringinfo_mb.h +24 -0
  155. data/ext/pg_query/include/miscadmin.h +476 -0
  156. data/ext/pg_query/include/nodes/bitmapset.h +122 -0
  157. data/ext/pg_query/include/nodes/execnodes.h +2520 -0
  158. data/ext/pg_query/include/nodes/extensible.h +160 -0
  159. data/ext/pg_query/include/nodes/lockoptions.h +61 -0
  160. data/ext/pg_query/include/nodes/makefuncs.h +108 -0
  161. data/ext/pg_query/include/nodes/memnodes.h +108 -0
  162. data/ext/pg_query/include/nodes/nodeFuncs.h +162 -0
  163. data/ext/pg_query/include/nodes/nodes.h +842 -0
  164. data/ext/pg_query/include/nodes/params.h +170 -0
  165. data/ext/pg_query/include/nodes/parsenodes.h +3579 -0
  166. data/ext/pg_query/include/nodes/pathnodes.h +2556 -0
  167. data/ext/pg_query/include/nodes/pg_list.h +605 -0
  168. data/ext/pg_query/include/nodes/plannodes.h +1251 -0
  169. data/ext/pg_query/include/nodes/primnodes.h +1541 -0
  170. data/ext/pg_query/include/nodes/print.h +34 -0
  171. data/ext/pg_query/include/nodes/tidbitmap.h +75 -0
  172. data/ext/pg_query/include/nodes/value.h +61 -0
  173. data/ext/pg_query/include/optimizer/cost.h +206 -0
  174. data/ext/pg_query/include/optimizer/geqo.h +88 -0
  175. data/ext/pg_query/include/optimizer/geqo_gene.h +45 -0
  176. data/ext/pg_query/include/optimizer/optimizer.h +199 -0
  177. data/ext/pg_query/include/optimizer/paths.h +249 -0
  178. data/ext/pg_query/include/optimizer/planmain.h +119 -0
  179. data/ext/pg_query/include/parser/analyze.h +49 -0
  180. data/ext/pg_query/include/parser/gram.h +1067 -0
  181. data/ext/pg_query/include/parser/gramparse.h +75 -0
  182. data/ext/pg_query/include/parser/kwlist.h +477 -0
  183. data/ext/pg_query/include/parser/parse_agg.h +68 -0
  184. data/ext/pg_query/include/parser/parse_clause.h +54 -0
  185. data/ext/pg_query/include/parser/parse_coerce.h +97 -0
  186. data/ext/pg_query/include/parser/parse_collate.h +27 -0
  187. data/ext/pg_query/include/parser/parse_expr.h +26 -0
  188. data/ext/pg_query/include/parser/parse_func.h +73 -0
  189. data/ext/pg_query/include/parser/parse_node.h +327 -0
  190. data/ext/pg_query/include/parser/parse_oper.h +67 -0
  191. data/ext/pg_query/include/parser/parse_relation.h +123 -0
  192. data/ext/pg_query/include/parser/parse_target.h +46 -0
  193. data/ext/pg_query/include/parser/parse_type.h +60 -0
  194. data/ext/pg_query/include/parser/parser.h +41 -0
  195. data/ext/pg_query/include/parser/parsetree.h +61 -0
  196. data/ext/pg_query/include/parser/scanner.h +152 -0
  197. data/ext/pg_query/include/parser/scansup.h +30 -0
  198. data/ext/pg_query/include/partitioning/partdefs.h +26 -0
  199. data/ext/pg_query/include/pg_config.h +988 -0
  200. data/ext/pg_query/include/pg_config_ext.h +8 -0
  201. data/ext/pg_query/include/pg_config_manual.h +350 -0
  202. data/ext/pg_query/include/pg_config_os.h +8 -0
  203. data/ext/pg_query/include/pg_getopt.h +56 -0
  204. data/ext/pg_query/include/pg_query.h +121 -0
  205. data/ext/pg_query/include/pg_query_enum_defs.c +2454 -0
  206. data/ext/pg_query/include/pg_query_fingerprint_conds.c +875 -0
  207. data/ext/pg_query/include/pg_query_fingerprint_defs.c +12413 -0
  208. data/ext/pg_query/include/pg_query_json_helper.c +61 -0
  209. data/ext/pg_query/include/pg_query_outfuncs_conds.c +686 -0
  210. data/ext/pg_query/include/pg_query_outfuncs_defs.c +2437 -0
  211. data/ext/pg_query/include/pg_query_readfuncs_conds.c +222 -0
  212. data/ext/pg_query/include/pg_query_readfuncs_defs.c +2878 -0
  213. data/ext/pg_query/include/pg_trace.h +17 -0
  214. data/ext/pg_query/include/pgstat.h +1487 -0
  215. data/ext/pg_query/include/pgtime.h +84 -0
  216. data/ext/pg_query/include/pl_gram.h +385 -0
  217. data/ext/pg_query/include/pl_reserved_kwlist.h +52 -0
  218. data/ext/pg_query/include/pl_reserved_kwlist_d.h +114 -0
  219. data/ext/pg_query/include/pl_unreserved_kwlist.h +112 -0
  220. data/ext/pg_query/include/pl_unreserved_kwlist_d.h +246 -0
  221. data/ext/pg_query/include/plerrcodes.h +990 -0
  222. data/ext/pg_query/include/plpgsql.h +1347 -0
  223. data/ext/pg_query/include/port.h +524 -0
  224. data/ext/pg_query/include/port/atomics.h +524 -0
  225. data/ext/pg_query/include/port/atomics/arch-arm.h +26 -0
  226. data/ext/pg_query/include/port/atomics/arch-ppc.h +254 -0
  227. data/ext/pg_query/include/port/atomics/arch-x86.h +252 -0
  228. data/ext/pg_query/include/port/atomics/fallback.h +170 -0
  229. data/ext/pg_query/include/port/atomics/generic-gcc.h +286 -0
  230. data/ext/pg_query/include/port/atomics/generic.h +401 -0
  231. data/ext/pg_query/include/port/pg_bitutils.h +226 -0
  232. data/ext/pg_query/include/port/pg_bswap.h +161 -0
  233. data/ext/pg_query/include/port/pg_crc32c.h +101 -0
  234. data/ext/pg_query/include/portability/instr_time.h +256 -0
  235. data/ext/pg_query/include/postgres.h +764 -0
  236. data/ext/pg_query/include/postgres_ext.h +74 -0
  237. data/ext/pg_query/include/postmaster/autovacuum.h +83 -0
  238. data/ext/pg_query/include/postmaster/bgworker.h +161 -0
  239. data/ext/pg_query/include/postmaster/bgworker_internals.h +64 -0
  240. data/ext/pg_query/include/postmaster/bgwriter.h +45 -0
  241. data/ext/pg_query/include/postmaster/fork_process.h +17 -0
  242. data/ext/pg_query/include/postmaster/interrupt.h +32 -0
  243. data/ext/pg_query/include/postmaster/pgarch.h +39 -0
  244. data/ext/pg_query/include/postmaster/postmaster.h +77 -0
  245. data/ext/pg_query/include/postmaster/syslogger.h +98 -0
  246. data/ext/pg_query/include/postmaster/walwriter.h +21 -0
  247. data/ext/pg_query/include/protobuf-c.h +1106 -0
  248. data/ext/pg_query/include/protobuf-c/protobuf-c.h +1106 -0
  249. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +10846 -0
  250. data/ext/pg_query/include/protobuf/pg_query.pb.h +124718 -0
  251. data/ext/pg_query/include/regex/regex.h +184 -0
  252. data/ext/pg_query/include/replication/logicallauncher.h +31 -0
  253. data/ext/pg_query/include/replication/logicalproto.h +110 -0
  254. data/ext/pg_query/include/replication/logicalworker.h +19 -0
  255. data/ext/pg_query/include/replication/origin.h +73 -0
  256. data/ext/pg_query/include/replication/reorderbuffer.h +467 -0
  257. data/ext/pg_query/include/replication/slot.h +219 -0
  258. data/ext/pg_query/include/replication/syncrep.h +115 -0
  259. data/ext/pg_query/include/replication/walreceiver.h +340 -0
  260. data/ext/pg_query/include/replication/walsender.h +74 -0
  261. data/ext/pg_query/include/rewrite/prs2lock.h +46 -0
  262. data/ext/pg_query/include/rewrite/rewriteHandler.h +40 -0
  263. data/ext/pg_query/include/rewrite/rewriteManip.h +87 -0
  264. data/ext/pg_query/include/rewrite/rewriteSupport.h +26 -0
  265. data/ext/pg_query/include/storage/backendid.h +37 -0
  266. data/ext/pg_query/include/storage/block.h +121 -0
  267. data/ext/pg_query/include/storage/buf.h +46 -0
  268. data/ext/pg_query/include/storage/bufmgr.h +292 -0
  269. data/ext/pg_query/include/storage/bufpage.h +459 -0
  270. data/ext/pg_query/include/storage/condition_variable.h +62 -0
  271. data/ext/pg_query/include/storage/dsm.h +61 -0
  272. data/ext/pg_query/include/storage/dsm_impl.h +75 -0
  273. data/ext/pg_query/include/storage/fd.h +168 -0
  274. data/ext/pg_query/include/storage/ipc.h +81 -0
  275. data/ext/pg_query/include/storage/item.h +19 -0
  276. data/ext/pg_query/include/storage/itemid.h +184 -0
  277. data/ext/pg_query/include/storage/itemptr.h +206 -0
  278. data/ext/pg_query/include/storage/large_object.h +100 -0
  279. data/ext/pg_query/include/storage/latch.h +190 -0
  280. data/ext/pg_query/include/storage/lmgr.h +114 -0
  281. data/ext/pg_query/include/storage/lock.h +612 -0
  282. data/ext/pg_query/include/storage/lockdefs.h +59 -0
  283. data/ext/pg_query/include/storage/lwlock.h +232 -0
  284. data/ext/pg_query/include/storage/lwlocknames.h +51 -0
  285. data/ext/pg_query/include/storage/off.h +57 -0
  286. data/ext/pg_query/include/storage/pg_sema.h +61 -0
  287. data/ext/pg_query/include/storage/pg_shmem.h +90 -0
  288. data/ext/pg_query/include/storage/pmsignal.h +94 -0
  289. data/ext/pg_query/include/storage/predicate.h +87 -0
  290. data/ext/pg_query/include/storage/proc.h +333 -0
  291. data/ext/pg_query/include/storage/proclist_types.h +51 -0
  292. data/ext/pg_query/include/storage/procsignal.h +75 -0
  293. data/ext/pg_query/include/storage/relfilenode.h +99 -0
  294. data/ext/pg_query/include/storage/s_lock.h +1047 -0
  295. data/ext/pg_query/include/storage/sharedfileset.h +45 -0
  296. data/ext/pg_query/include/storage/shm_mq.h +85 -0
  297. data/ext/pg_query/include/storage/shm_toc.h +58 -0
  298. data/ext/pg_query/include/storage/shmem.h +81 -0
  299. data/ext/pg_query/include/storage/sinval.h +153 -0
  300. data/ext/pg_query/include/storage/sinvaladt.h +43 -0
  301. data/ext/pg_query/include/storage/smgr.h +109 -0
  302. data/ext/pg_query/include/storage/spin.h +77 -0
  303. data/ext/pg_query/include/storage/standby.h +91 -0
  304. data/ext/pg_query/include/storage/standbydefs.h +74 -0
  305. data/ext/pg_query/include/storage/sync.h +62 -0
  306. data/ext/pg_query/include/tcop/cmdtag.h +58 -0
  307. data/ext/pg_query/include/tcop/cmdtaglist.h +217 -0
  308. data/ext/pg_query/include/tcop/deparse_utility.h +108 -0
  309. data/ext/pg_query/include/tcop/dest.h +149 -0
  310. data/ext/pg_query/include/tcop/fastpath.h +21 -0
  311. data/ext/pg_query/include/tcop/pquery.h +45 -0
  312. data/ext/pg_query/include/tcop/tcopprot.h +89 -0
  313. data/ext/pg_query/include/tcop/utility.h +108 -0
  314. data/ext/pg_query/include/tsearch/ts_cache.h +98 -0
  315. data/ext/pg_query/include/utils/acl.h +312 -0
  316. data/ext/pg_query/include/utils/aclchk_internal.h +45 -0
  317. data/ext/pg_query/include/utils/array.h +458 -0
  318. data/ext/pg_query/include/utils/builtins.h +127 -0
  319. data/ext/pg_query/include/utils/bytea.h +27 -0
  320. data/ext/pg_query/include/utils/catcache.h +231 -0
  321. data/ext/pg_query/include/utils/date.h +90 -0
  322. data/ext/pg_query/include/utils/datetime.h +343 -0
  323. data/ext/pg_query/include/utils/datum.h +68 -0
  324. data/ext/pg_query/include/utils/dsa.h +123 -0
  325. data/ext/pg_query/include/utils/dynahash.h +19 -0
  326. data/ext/pg_query/include/utils/elog.h +439 -0
  327. data/ext/pg_query/include/utils/errcodes.h +352 -0
  328. data/ext/pg_query/include/utils/expandeddatum.h +159 -0
  329. data/ext/pg_query/include/utils/expandedrecord.h +231 -0
  330. data/ext/pg_query/include/utils/float.h +356 -0
  331. data/ext/pg_query/include/utils/fmgroids.h +2657 -0
  332. data/ext/pg_query/include/utils/fmgrprotos.h +2646 -0
  333. data/ext/pg_query/include/utils/fmgrtab.h +48 -0
  334. data/ext/pg_query/include/utils/guc.h +443 -0
  335. data/ext/pg_query/include/utils/guc_tables.h +272 -0
  336. data/ext/pg_query/include/utils/hsearch.h +149 -0
  337. data/ext/pg_query/include/utils/inval.h +64 -0
  338. data/ext/pg_query/include/utils/lsyscache.h +197 -0
  339. data/ext/pg_query/include/utils/memdebug.h +82 -0
  340. data/ext/pg_query/include/utils/memutils.h +225 -0
  341. data/ext/pg_query/include/utils/numeric.h +76 -0
  342. data/ext/pg_query/include/utils/palloc.h +136 -0
  343. data/ext/pg_query/include/utils/partcache.h +102 -0
  344. data/ext/pg_query/include/utils/pg_locale.h +119 -0
  345. data/ext/pg_query/include/utils/pg_lsn.h +29 -0
  346. data/ext/pg_query/include/utils/pidfile.h +56 -0
  347. data/ext/pg_query/include/utils/plancache.h +235 -0
  348. data/ext/pg_query/include/utils/portal.h +241 -0
  349. data/ext/pg_query/include/utils/probes.h +114 -0
  350. data/ext/pg_query/include/utils/ps_status.h +25 -0
  351. data/ext/pg_query/include/utils/queryenvironment.h +74 -0
  352. data/ext/pg_query/include/utils/regproc.h +28 -0
  353. data/ext/pg_query/include/utils/rel.h +644 -0
  354. data/ext/pg_query/include/utils/relcache.h +151 -0
  355. data/ext/pg_query/include/utils/reltrigger.h +81 -0
  356. data/ext/pg_query/include/utils/resowner.h +86 -0
  357. data/ext/pg_query/include/utils/rls.h +50 -0
  358. data/ext/pg_query/include/utils/ruleutils.h +44 -0
  359. data/ext/pg_query/include/utils/sharedtuplestore.h +61 -0
  360. data/ext/pg_query/include/utils/snapmgr.h +158 -0
  361. data/ext/pg_query/include/utils/snapshot.h +206 -0
  362. data/ext/pg_query/include/utils/sortsupport.h +276 -0
  363. data/ext/pg_query/include/utils/syscache.h +219 -0
  364. data/ext/pg_query/include/utils/timeout.h +88 -0
  365. data/ext/pg_query/include/utils/timestamp.h +116 -0
  366. data/ext/pg_query/include/utils/tuplesort.h +277 -0
  367. data/ext/pg_query/include/utils/tuplestore.h +91 -0
  368. data/ext/pg_query/include/utils/typcache.h +202 -0
  369. data/ext/pg_query/include/utils/tzparser.h +39 -0
  370. data/ext/pg_query/include/utils/varlena.h +39 -0
  371. data/ext/pg_query/include/utils/xml.h +84 -0
  372. data/ext/pg_query/include/xxhash.h +5445 -0
  373. data/ext/pg_query/include/xxhash/xxhash.h +5445 -0
  374. data/lib/pg_query/version.rb +1 -1
  375. metadata +372 -1
@@ -0,0 +1,197 @@
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * timestamp.h
4
+ * Timestamp and Interval typedefs and related macros.
5
+ *
6
+ * Note: this file must be includable in both frontend and backend contexts.
7
+ *
8
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
9
+ * Portions Copyright (c) 1994, Regents of the University of California
10
+ *
11
+ * src/include/datatype/timestamp.h
12
+ *
13
+ *-------------------------------------------------------------------------
14
+ */
15
+ #ifndef DATATYPE_TIMESTAMP_H
16
+ #define DATATYPE_TIMESTAMP_H
17
+
18
+ /*
19
+ * Timestamp represents absolute time.
20
+ *
21
+ * Interval represents delta time. Keep track of months (and years), days,
22
+ * and hours/minutes/seconds separately since the elapsed time spanned is
23
+ * unknown until instantiated relative to an absolute time.
24
+ *
25
+ * Note that Postgres uses "time interval" to mean a bounded interval,
26
+ * consisting of a beginning and ending time, not a time span - thomas 97/03/20
27
+ *
28
+ * Timestamps, as well as the h/m/s fields of intervals, are stored as
29
+ * int64 values with units of microseconds. (Once upon a time they were
30
+ * double values with units of seconds.)
31
+ *
32
+ * TimeOffset and fsec_t are convenience typedefs for temporary variables.
33
+ * Do not use fsec_t in values stored on-disk.
34
+ * Also, fsec_t is only meant for *fractional* seconds; beware of overflow
35
+ * if the value you need to store could be many seconds.
36
+ */
37
+
38
+ typedef int64 Timestamp;
39
+ typedef int64 TimestampTz;
40
+ typedef int64 TimeOffset;
41
+ typedef int32 fsec_t; /* fractional seconds (in microseconds) */
42
+
43
+ typedef struct
44
+ {
45
+ TimeOffset time; /* all time units other than days, months and
46
+ * years */
47
+ int32 day; /* days, after time for alignment */
48
+ int32 month; /* months and years, after time for alignment */
49
+ } Interval;
50
+
51
+
52
+ /* Limits on the "precision" option (typmod) for these data types */
53
+ #define MAX_TIMESTAMP_PRECISION 6
54
+ #define MAX_INTERVAL_PRECISION 6
55
+
56
+ /*
57
+ * Round off to MAX_TIMESTAMP_PRECISION decimal places.
58
+ * Note: this is also used for rounding off intervals.
59
+ */
60
+ #define TS_PREC_INV 1000000.0
61
+ #define TSROUND(j) (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV)
62
+
63
+
64
+ /*
65
+ * Assorted constants for datetime-related calculations
66
+ */
67
+
68
+ #define DAYS_PER_YEAR 365.25 /* assumes leap year every four years */
69
+ #define MONTHS_PER_YEAR 12
70
+ /*
71
+ * DAYS_PER_MONTH is very imprecise. The more accurate value is
72
+ * 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only
73
+ * return an integral number of days, but someday perhaps we should
74
+ * also return a 'time' value to be used as well. ISO 8601 suggests
75
+ * 30 days.
76
+ */
77
+ #define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
78
+ #define HOURS_PER_DAY 24 /* assume no daylight savings time changes */
79
+
80
+ /*
81
+ * This doesn't adjust for uneven daylight savings time intervals or leap
82
+ * seconds, and it crudely estimates leap years. A more accurate value
83
+ * for days per years is 365.2422.
84
+ */
85
+ #define SECS_PER_YEAR (36525 * 864) /* avoid floating-point computation */
86
+ #define SECS_PER_DAY 86400
87
+ #define SECS_PER_HOUR 3600
88
+ #define SECS_PER_MINUTE 60
89
+ #define MINS_PER_HOUR 60
90
+
91
+ #define USECS_PER_DAY INT64CONST(86400000000)
92
+ #define USECS_PER_HOUR INT64CONST(3600000000)
93
+ #define USECS_PER_MINUTE INT64CONST(60000000)
94
+ #define USECS_PER_SEC INT64CONST(1000000)
95
+
96
+ /*
97
+ * We allow numeric timezone offsets up to 15:59:59 either way from Greenwich.
98
+ * Currently, the record holders for wackiest offsets in actual use are zones
99
+ * Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42
100
+ * until 1867. If we were to reject such values we would fail to dump and
101
+ * restore old timestamptz values with these zone settings.
102
+ */
103
+ #define MAX_TZDISP_HOUR 15 /* maximum allowed hour part */
104
+ #define TZDISP_LIMIT ((MAX_TZDISP_HOUR + 1) * SECS_PER_HOUR)
105
+
106
+ /*
107
+ * DT_NOBEGIN represents timestamp -infinity; DT_NOEND represents +infinity
108
+ */
109
+ #define DT_NOBEGIN PG_INT64_MIN
110
+ #define DT_NOEND PG_INT64_MAX
111
+
112
+ #define TIMESTAMP_NOBEGIN(j) \
113
+ do {(j) = DT_NOBEGIN;} while (0)
114
+
115
+ #define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN)
116
+
117
+ #define TIMESTAMP_NOEND(j) \
118
+ do {(j) = DT_NOEND;} while (0)
119
+
120
+ #define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND)
121
+
122
+ #define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j))
123
+
124
+
125
+ /*
126
+ * Julian date support.
127
+ *
128
+ * date2j() and j2date() nominally handle the Julian date range 0..INT_MAX,
129
+ * or 4714-11-24 BC to 5874898-06-03 AD. In practice, date2j() will work and
130
+ * give correct negative Julian dates for dates before 4714-11-24 BC as well.
131
+ * We rely on it to do so back to 4714-11-01 BC. Allowing at least one day's
132
+ * slop is necessary so that timestamp rotation doesn't produce dates that
133
+ * would be rejected on input. For example, '4714-11-24 00:00 GMT BC' is a
134
+ * legal timestamptz value, but in zones east of Greenwich it would print as
135
+ * sometime in the afternoon of 4714-11-23 BC; if we couldn't process such a
136
+ * date we'd have a dump/reload failure. So the idea is for IS_VALID_JULIAN
137
+ * to accept a slightly wider range of dates than we really support, and
138
+ * then we apply the exact checks in IS_VALID_DATE or IS_VALID_TIMESTAMP,
139
+ * after timezone rotation if any. To save a few cycles, we can make
140
+ * IS_VALID_JULIAN check only to the month boundary, since its exact cutoffs
141
+ * are not very critical in this scheme.
142
+ *
143
+ * It is correct that JULIAN_MINYEAR is -4713, not -4714; it is defined to
144
+ * allow easy comparison to tm_year values, in which we follow the convention
145
+ * that tm_year <= 0 represents abs(tm_year)+1 BC.
146
+ */
147
+
148
+ #define JULIAN_MINYEAR (-4713)
149
+ #define JULIAN_MINMONTH (11)
150
+ #define JULIAN_MINDAY (24)
151
+ #define JULIAN_MAXYEAR (5874898)
152
+ #define JULIAN_MAXMONTH (6)
153
+ #define JULIAN_MAXDAY (3)
154
+
155
+ #define IS_VALID_JULIAN(y,m,d) \
156
+ (((y) > JULIAN_MINYEAR || \
157
+ ((y) == JULIAN_MINYEAR && ((m) >= JULIAN_MINMONTH))) && \
158
+ ((y) < JULIAN_MAXYEAR || \
159
+ ((y) == JULIAN_MAXYEAR && ((m) < JULIAN_MAXMONTH))))
160
+
161
+ /* Julian-date equivalents of Day 0 in Unix and Postgres reckoning */
162
+ #define UNIX_EPOCH_JDATE 2440588 /* == date2j(1970, 1, 1) */
163
+ #define POSTGRES_EPOCH_JDATE 2451545 /* == date2j(2000, 1, 1) */
164
+
165
+ /*
166
+ * Range limits for dates and timestamps.
167
+ *
168
+ * We have traditionally allowed Julian day zero as a valid datetime value,
169
+ * so that is the lower bound for both dates and timestamps.
170
+ *
171
+ * The upper limit for dates is 5874897-12-31, which is a bit less than what
172
+ * the Julian-date code can allow. For timestamps, the upper limit is
173
+ * 294276-12-31. The int64 overflow limit would be a few days later; again,
174
+ * leaving some slop avoids worries about corner-case overflow, and provides
175
+ * a simpler user-visible definition.
176
+ */
177
+
178
+ /* First allowed date, and first disallowed date, in Julian-date form */
179
+ #define DATETIME_MIN_JULIAN (0)
180
+ #define DATE_END_JULIAN (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */
181
+ #define TIMESTAMP_END_JULIAN (109203528) /* == date2j(294277, 1, 1) */
182
+
183
+ /* Timestamp limits */
184
+ #define MIN_TIMESTAMP INT64CONST(-211813488000000000)
185
+ /* == (DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */
186
+ #define END_TIMESTAMP INT64CONST(9223371331200000000)
187
+ /* == (TIMESTAMP_END_JULIAN - POSTGRES_EPOCH_JDATE) * USECS_PER_DAY */
188
+
189
+ /* Range-check a date (given in Postgres, not Julian, numbering) */
190
+ #define IS_VALID_DATE(d) \
191
+ ((DATETIME_MIN_JULIAN - POSTGRES_EPOCH_JDATE) <= (d) && \
192
+ (d) < (DATE_END_JULIAN - POSTGRES_EPOCH_JDATE))
193
+
194
+ /* Range-check a timestamp */
195
+ #define IS_VALID_TIMESTAMP(t) (MIN_TIMESTAMP <= (t) && (t) < END_TIMESTAMP)
196
+
197
+ #endif /* DATATYPE_TIMESTAMP_H */
@@ -0,0 +1,70 @@
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * execdesc.h
4
+ * plan and query descriptor accessor macros used by the executor
5
+ * and related modules.
6
+ *
7
+ *
8
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
9
+ * Portions Copyright (c) 1994, Regents of the University of California
10
+ *
11
+ * src/include/executor/execdesc.h
12
+ *
13
+ *-------------------------------------------------------------------------
14
+ */
15
+ #ifndef EXECDESC_H
16
+ #define EXECDESC_H
17
+
18
+ #include "nodes/execnodes.h"
19
+ #include "tcop/dest.h"
20
+
21
+
22
+ /* ----------------
23
+ * query descriptor:
24
+ *
25
+ * a QueryDesc encapsulates everything that the executor
26
+ * needs to execute the query.
27
+ *
28
+ * For the convenience of SQL-language functions, we also support QueryDescs
29
+ * containing utility statements; these must not be passed to the executor
30
+ * however.
31
+ * ---------------------
32
+ */
33
+ typedef struct QueryDesc
34
+ {
35
+ /* These fields are provided by CreateQueryDesc */
36
+ CmdType operation; /* CMD_SELECT, CMD_UPDATE, etc. */
37
+ PlannedStmt *plannedstmt; /* planner's output (could be utility, too) */
38
+ const char *sourceText; /* source text of the query */
39
+ Snapshot snapshot; /* snapshot to use for query */
40
+ Snapshot crosscheck_snapshot; /* crosscheck for RI update/delete */
41
+ DestReceiver *dest; /* the destination for tuple output */
42
+ ParamListInfo params; /* param values being passed in */
43
+ QueryEnvironment *queryEnv; /* query environment passed in */
44
+ int instrument_options; /* OR of InstrumentOption flags */
45
+
46
+ /* These fields are set by ExecutorStart */
47
+ TupleDesc tupDesc; /* descriptor for result tuples */
48
+ EState *estate; /* executor's query-wide state */
49
+ PlanState *planstate; /* tree of per-plan-node state */
50
+
51
+ /* This field is set by ExecutorRun */
52
+ bool already_executed; /* true if previously executed */
53
+
54
+ /* This is always set NULL by the core system, but plugins can change it */
55
+ struct Instrumentation *totaltime; /* total time spent in ExecutorRun */
56
+ } QueryDesc;
57
+
58
+ /* in pquery.c */
59
+ extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt,
60
+ const char *sourceText,
61
+ Snapshot snapshot,
62
+ Snapshot crosscheck_snapshot,
63
+ DestReceiver *dest,
64
+ ParamListInfo params,
65
+ QueryEnvironment *queryEnv,
66
+ int instrument_options);
67
+
68
+ extern void FreeQueryDesc(QueryDesc *qdesc);
69
+
70
+ #endif /* EXECDESC_H */
@@ -0,0 +1,614 @@
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * executor.h
4
+ * support for the POSTGRES executor module
5
+ *
6
+ *
7
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
8
+ * Portions Copyright (c) 1994, Regents of the University of California
9
+ *
10
+ * src/include/executor/executor.h
11
+ *
12
+ *-------------------------------------------------------------------------
13
+ */
14
+ #ifndef EXECUTOR_H
15
+ #define EXECUTOR_H
16
+
17
+ #include "executor/execdesc.h"
18
+ #include "fmgr.h"
19
+ #include "nodes/lockoptions.h"
20
+ #include "nodes/parsenodes.h"
21
+ #include "utils/memutils.h"
22
+
23
+
24
+ /*
25
+ * The "eflags" argument to ExecutorStart and the various ExecInitNode
26
+ * routines is a bitwise OR of the following flag bits, which tell the
27
+ * called plan node what to expect. Note that the flags will get modified
28
+ * as they are passed down the plan tree, since an upper node may require
29
+ * functionality in its subnode not demanded of the plan as a whole
30
+ * (example: MergeJoin requires mark/restore capability in its inner input),
31
+ * or an upper node may shield its input from some functionality requirement
32
+ * (example: Materialize shields its input from needing to do backward scan).
33
+ *
34
+ * EXPLAIN_ONLY indicates that the plan tree is being initialized just so
35
+ * EXPLAIN can print it out; it will not be run. Hence, no side-effects
36
+ * of startup should occur. However, error checks (such as permission checks)
37
+ * should be performed.
38
+ *
39
+ * REWIND indicates that the plan node should try to efficiently support
40
+ * rescans without parameter changes. (Nodes must support ExecReScan calls
41
+ * in any case, but if this flag was not given, they are at liberty to do it
42
+ * through complete recalculation. Note that a parameter change forces a
43
+ * full recalculation in any case.)
44
+ *
45
+ * BACKWARD indicates that the plan node must respect the es_direction flag.
46
+ * When this is not passed, the plan node will only be run forwards.
47
+ *
48
+ * MARK indicates that the plan node must support Mark/Restore calls.
49
+ * When this is not passed, no Mark/Restore will occur.
50
+ *
51
+ * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling
52
+ * AfterTriggerBeginQuery/AfterTriggerEndQuery. This does not necessarily
53
+ * mean that the plan can't queue any AFTER triggers; just that the caller
54
+ * is responsible for there being a trigger context for them to be queued in.
55
+ */
56
+ #define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */
57
+ #define EXEC_FLAG_REWIND 0x0002 /* need efficient rescan */
58
+ #define EXEC_FLAG_BACKWARD 0x0004 /* need backward scan */
59
+ #define EXEC_FLAG_MARK 0x0008 /* need mark/restore */
60
+ #define EXEC_FLAG_SKIP_TRIGGERS 0x0010 /* skip AfterTrigger calls */
61
+ #define EXEC_FLAG_WITH_NO_DATA 0x0020 /* rel scannability doesn't matter */
62
+
63
+
64
+ /* Hook for plugins to get control in ExecutorStart() */
65
+ typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);
66
+ extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook;
67
+
68
+ /* Hook for plugins to get control in ExecutorRun() */
69
+ typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc,
70
+ ScanDirection direction,
71
+ uint64 count,
72
+ bool execute_once);
73
+ extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook;
74
+
75
+ /* Hook for plugins to get control in ExecutorFinish() */
76
+ typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc);
77
+ extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook;
78
+
79
+ /* Hook for plugins to get control in ExecutorEnd() */
80
+ typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
81
+ extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;
82
+
83
+ /* Hook for plugins to get control in ExecCheckRTPerms() */
84
+ typedef bool (*ExecutorCheckPerms_hook_type) (List *, bool);
85
+ extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook;
86
+
87
+
88
+ /*
89
+ * prototypes from functions in execAmi.c
90
+ */
91
+ struct Path; /* avoid including pathnodes.h here */
92
+
93
+ extern void ExecReScan(PlanState *node);
94
+ extern void ExecMarkPos(PlanState *node);
95
+ extern void ExecRestrPos(PlanState *node);
96
+ extern bool ExecSupportsMarkRestore(struct Path *pathnode);
97
+ extern bool ExecSupportsBackwardScan(Plan *node);
98
+ extern bool ExecMaterializesOutput(NodeTag plantype);
99
+
100
+ /*
101
+ * prototypes from functions in execCurrent.c
102
+ */
103
+ extern bool execCurrentOf(CurrentOfExpr *cexpr,
104
+ ExprContext *econtext,
105
+ Oid table_oid,
106
+ ItemPointer current_tid);
107
+
108
+ /*
109
+ * prototypes from functions in execGrouping.c
110
+ */
111
+ extern ExprState *execTuplesMatchPrepare(TupleDesc desc,
112
+ int numCols,
113
+ const AttrNumber *keyColIdx,
114
+ const Oid *eqOperators,
115
+ const Oid *collations,
116
+ PlanState *parent);
117
+ extern void execTuplesHashPrepare(int numCols,
118
+ const Oid *eqOperators,
119
+ Oid **eqFuncOids,
120
+ FmgrInfo **hashFunctions);
121
+ extern TupleHashTable BuildTupleHashTable(PlanState *parent,
122
+ TupleDesc inputDesc,
123
+ int numCols, AttrNumber *keyColIdx,
124
+ const Oid *eqfuncoids,
125
+ FmgrInfo *hashfunctions,
126
+ Oid *collations,
127
+ long nbuckets, Size additionalsize,
128
+ MemoryContext tablecxt,
129
+ MemoryContext tempcxt, bool use_variable_hash_iv);
130
+ extern TupleHashTable BuildTupleHashTableExt(PlanState *parent,
131
+ TupleDesc inputDesc,
132
+ int numCols, AttrNumber *keyColIdx,
133
+ const Oid *eqfuncoids,
134
+ FmgrInfo *hashfunctions,
135
+ Oid *collations,
136
+ long nbuckets, Size additionalsize,
137
+ MemoryContext metacxt,
138
+ MemoryContext tablecxt,
139
+ MemoryContext tempcxt, bool use_variable_hash_iv);
140
+ extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable,
141
+ TupleTableSlot *slot,
142
+ bool *isnew, uint32 *hash);
143
+ extern uint32 TupleHashTableHash(TupleHashTable hashtable,
144
+ TupleTableSlot *slot);
145
+ extern TupleHashEntry LookupTupleHashEntryHash(TupleHashTable hashtable,
146
+ TupleTableSlot *slot,
147
+ bool *isnew, uint32 hash);
148
+ extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable,
149
+ TupleTableSlot *slot,
150
+ ExprState *eqcomp,
151
+ FmgrInfo *hashfunctions);
152
+ extern void ResetTupleHashTable(TupleHashTable hashtable);
153
+
154
+ /*
155
+ * prototypes from functions in execJunk.c
156
+ */
157
+ extern JunkFilter *ExecInitJunkFilter(List *targetList,
158
+ TupleTableSlot *slot);
159
+ extern JunkFilter *ExecInitJunkFilterInsertion(List *targetList,
160
+ TupleDesc cleanTupType,
161
+ TupleTableSlot *slot);
162
+ extern JunkFilter *ExecInitJunkFilterConversion(List *targetList,
163
+ TupleDesc cleanTupType,
164
+ TupleTableSlot *slot);
165
+ extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter,
166
+ const char *attrName);
167
+ extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist,
168
+ const char *attrName);
169
+ extern Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno,
170
+ bool *isNull);
171
+ extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter,
172
+ TupleTableSlot *slot);
173
+
174
+
175
+ /*
176
+ * prototypes from functions in execMain.c
177
+ */
178
+ extern void ExecutorStart(QueryDesc *queryDesc, int eflags);
179
+ extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags);
180
+ extern void ExecutorRun(QueryDesc *queryDesc,
181
+ ScanDirection direction, uint64 count, bool execute_once);
182
+ extern void standard_ExecutorRun(QueryDesc *queryDesc,
183
+ ScanDirection direction, uint64 count, bool execute_once);
184
+ extern void ExecutorFinish(QueryDesc *queryDesc);
185
+ extern void standard_ExecutorFinish(QueryDesc *queryDesc);
186
+ extern void ExecutorEnd(QueryDesc *queryDesc);
187
+ extern void standard_ExecutorEnd(QueryDesc *queryDesc);
188
+ extern void ExecutorRewind(QueryDesc *queryDesc);
189
+ extern bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation);
190
+ extern void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation);
191
+ extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
192
+ Relation resultRelationDesc,
193
+ Index resultRelationIndex,
194
+ ResultRelInfo *partition_root_rri,
195
+ int instrument_options);
196
+ extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid);
197
+ extern void ExecCleanUpTriggerState(EState *estate);
198
+ extern void ExecConstraints(ResultRelInfo *resultRelInfo,
199
+ TupleTableSlot *slot, EState *estate);
200
+ extern bool ExecPartitionCheck(ResultRelInfo *resultRelInfo,
201
+ TupleTableSlot *slot, EState *estate, bool emitError);
202
+ extern void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo,
203
+ TupleTableSlot *slot, EState *estate);
204
+ extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
205
+ TupleTableSlot *slot, EState *estate);
206
+ extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo);
207
+ extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok);
208
+ extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist);
209
+ extern TupleTableSlot *EvalPlanQual(EPQState *epqstate, Relation relation,
210
+ Index rti, TupleTableSlot *testslot);
211
+ extern void EvalPlanQualInit(EPQState *epqstate, EState *parentestate,
212
+ Plan *subplan, List *auxrowmarks, int epqParam);
213
+ extern void EvalPlanQualSetPlan(EPQState *epqstate,
214
+ Plan *subplan, List *auxrowmarks);
215
+ extern TupleTableSlot *EvalPlanQualSlot(EPQState *epqstate,
216
+ Relation relation, Index rti);
217
+
218
+ #define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot))
219
+ extern bool EvalPlanQualFetchRowMark(EPQState *epqstate, Index rti, TupleTableSlot *slot);
220
+ extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate);
221
+ extern void EvalPlanQualBegin(EPQState *epqstate);
222
+ extern void EvalPlanQualEnd(EPQState *epqstate);
223
+
224
+ /*
225
+ * functions in execProcnode.c
226
+ */
227
+ extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags);
228
+ extern void ExecSetExecProcNode(PlanState *node, ExecProcNodeMtd function);
229
+ extern Node *MultiExecProcNode(PlanState *node);
230
+ extern void ExecEndNode(PlanState *node);
231
+ extern bool ExecShutdownNode(PlanState *node);
232
+ extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node);
233
+
234
+
235
+ /* ----------------------------------------------------------------
236
+ * ExecProcNode
237
+ *
238
+ * Execute the given node to return a(nother) tuple.
239
+ * ----------------------------------------------------------------
240
+ */
241
+ #ifndef FRONTEND
242
+ static inline TupleTableSlot *
243
+ ExecProcNode(PlanState *node)
244
+ {
245
+ if (node->chgParam != NULL) /* something changed? */
246
+ ExecReScan(node); /* let ReScan handle this */
247
+
248
+ return node->ExecProcNode(node);
249
+ }
250
+ #endif
251
+
252
+ /*
253
+ * prototypes from functions in execExpr.c
254
+ */
255
+ extern ExprState *ExecInitExpr(Expr *node, PlanState *parent);
256
+ extern ExprState *ExecInitExprWithParams(Expr *node, ParamListInfo ext_params);
257
+ extern ExprState *ExecInitQual(List *qual, PlanState *parent);
258
+ extern ExprState *ExecInitCheck(List *qual, PlanState *parent);
259
+ extern List *ExecInitExprList(List *nodes, PlanState *parent);
260
+ extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase,
261
+ bool doSort, bool doHash, bool nullcheck);
262
+ extern ExprState *ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc,
263
+ const TupleTableSlotOps *lops, const TupleTableSlotOps *rops,
264
+ int numCols,
265
+ const AttrNumber *keyColIdx,
266
+ const Oid *eqfunctions,
267
+ const Oid *collations,
268
+ PlanState *parent);
269
+ extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
270
+ ExprContext *econtext,
271
+ TupleTableSlot *slot,
272
+ PlanState *parent,
273
+ TupleDesc inputDesc);
274
+ extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
275
+ extern ExprState *ExecPrepareQual(List *qual, EState *estate);
276
+ extern ExprState *ExecPrepareCheck(List *qual, EState *estate);
277
+ extern List *ExecPrepareExprList(List *nodes, EState *estate);
278
+
279
+ /*
280
+ * ExecEvalExpr
281
+ *
282
+ * Evaluate expression identified by "state" in the execution context
283
+ * given by "econtext". *isNull is set to the is-null flag for the result,
284
+ * and the Datum value is the function result.
285
+ *
286
+ * The caller should already have switched into the temporary memory
287
+ * context econtext->ecxt_per_tuple_memory. The convenience entry point
288
+ * ExecEvalExprSwitchContext() is provided for callers who don't prefer to
289
+ * do the switch in an outer loop.
290
+ */
291
+ #ifndef FRONTEND
292
+ static inline Datum
293
+ ExecEvalExpr(ExprState *state,
294
+ ExprContext *econtext,
295
+ bool *isNull)
296
+ {
297
+ return state->evalfunc(state, econtext, isNull);
298
+ }
299
+ #endif
300
+
301
+ /*
302
+ * ExecEvalExprSwitchContext
303
+ *
304
+ * Same as ExecEvalExpr, but get into the right allocation context explicitly.
305
+ */
306
+ #ifndef FRONTEND
307
+ static inline Datum
308
+ ExecEvalExprSwitchContext(ExprState *state,
309
+ ExprContext *econtext,
310
+ bool *isNull)
311
+ {
312
+ Datum retDatum;
313
+ MemoryContext oldContext;
314
+
315
+ oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
316
+ retDatum = state->evalfunc(state, econtext, isNull);
317
+ MemoryContextSwitchTo(oldContext);
318
+ return retDatum;
319
+ }
320
+ #endif
321
+
322
+ /*
323
+ * ExecProject
324
+ *
325
+ * Projects a tuple based on projection info and stores it in the slot passed
326
+ * to ExecBuildProjectionInfo().
327
+ *
328
+ * Note: the result is always a virtual tuple; therefore it may reference
329
+ * the contents of the exprContext's scan tuples and/or temporary results
330
+ * constructed in the exprContext. If the caller wishes the result to be
331
+ * valid longer than that data will be valid, he must call ExecMaterializeSlot
332
+ * on the result slot.
333
+ */
334
+ #ifndef FRONTEND
335
+ static inline TupleTableSlot *
336
+ ExecProject(ProjectionInfo *projInfo)
337
+ {
338
+ ExprContext *econtext = projInfo->pi_exprContext;
339
+ ExprState *state = &projInfo->pi_state;
340
+ TupleTableSlot *slot = state->resultslot;
341
+ bool isnull;
342
+
343
+ /*
344
+ * Clear any former contents of the result slot. This makes it safe for
345
+ * us to use the slot's Datum/isnull arrays as workspace.
346
+ */
347
+ ExecClearTuple(slot);
348
+
349
+ /* Run the expression, discarding scalar result from the last column. */
350
+ (void) ExecEvalExprSwitchContext(state, econtext, &isnull);
351
+
352
+ /*
353
+ * Successfully formed a result row. Mark the result slot as containing a
354
+ * valid virtual tuple (inlined version of ExecStoreVirtualTuple()).
355
+ */
356
+ slot->tts_flags &= ~TTS_FLAG_EMPTY;
357
+ slot->tts_nvalid = slot->tts_tupleDescriptor->natts;
358
+
359
+ return slot;
360
+ }
361
+ #endif
362
+
363
+ /*
364
+ * ExecQual - evaluate a qual prepared with ExecInitQual (possibly via
365
+ * ExecPrepareQual). Returns true if qual is satisfied, else false.
366
+ *
367
+ * Note: ExecQual used to have a third argument "resultForNull". The
368
+ * behavior of this function now corresponds to resultForNull == false.
369
+ * If you want the resultForNull == true behavior, see ExecCheck.
370
+ */
371
+ #ifndef FRONTEND
372
+ static inline bool
373
+ ExecQual(ExprState *state, ExprContext *econtext)
374
+ {
375
+ Datum ret;
376
+ bool isnull;
377
+
378
+ /* short-circuit (here and in ExecInitQual) for empty restriction list */
379
+ if (state == NULL)
380
+ return true;
381
+
382
+ /* verify that expression was compiled using ExecInitQual */
383
+ Assert(state->flags & EEO_FLAG_IS_QUAL);
384
+
385
+ ret = ExecEvalExprSwitchContext(state, econtext, &isnull);
386
+
387
+ /* EEOP_QUAL should never return NULL */
388
+ Assert(!isnull);
389
+
390
+ return DatumGetBool(ret);
391
+ }
392
+ #endif
393
+
394
+ /*
395
+ * ExecQualAndReset() - evaluate qual with ExecQual() and reset expression
396
+ * context.
397
+ */
398
+ #ifndef FRONTEND
399
+ static inline bool
400
+ ExecQualAndReset(ExprState *state, ExprContext *econtext)
401
+ {
402
+ bool ret = ExecQual(state, econtext);
403
+
404
+ /* inline ResetExprContext, to avoid ordering issue in this file */
405
+ MemoryContextReset(econtext->ecxt_per_tuple_memory);
406
+ return ret;
407
+ }
408
+ #endif
409
+
410
+ extern bool ExecCheck(ExprState *state, ExprContext *context);
411
+
412
+ /*
413
+ * prototypes from functions in execSRF.c
414
+ */
415
+ extern SetExprState *ExecInitTableFunctionResult(Expr *expr,
416
+ ExprContext *econtext, PlanState *parent);
417
+ extern Tuplestorestate *ExecMakeTableFunctionResult(SetExprState *setexpr,
418
+ ExprContext *econtext,
419
+ MemoryContext argContext,
420
+ TupleDesc expectedDesc,
421
+ bool randomAccess);
422
+ extern SetExprState *ExecInitFunctionResultSet(Expr *expr,
423
+ ExprContext *econtext, PlanState *parent);
424
+ extern Datum ExecMakeFunctionResultSet(SetExprState *fcache,
425
+ ExprContext *econtext,
426
+ MemoryContext argContext,
427
+ bool *isNull,
428
+ ExprDoneCond *isDone);
429
+
430
+ /*
431
+ * prototypes from functions in execScan.c
432
+ */
433
+ typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node);
434
+ typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot);
435
+
436
+ extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd,
437
+ ExecScanRecheckMtd recheckMtd);
438
+ extern void ExecAssignScanProjectionInfo(ScanState *node);
439
+ extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, Index varno);
440
+ extern void ExecScanReScan(ScanState *node);
441
+
442
+ /*
443
+ * prototypes from functions in execTuples.c
444
+ */
445
+ extern void ExecInitResultTypeTL(PlanState *planstate);
446
+ extern void ExecInitResultSlot(PlanState *planstate,
447
+ const TupleTableSlotOps *tts_ops);
448
+ extern void ExecInitResultTupleSlotTL(PlanState *planstate,
449
+ const TupleTableSlotOps *tts_ops);
450
+ extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate,
451
+ TupleDesc tupleDesc,
452
+ const TupleTableSlotOps *tts_ops);
453
+ extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate,
454
+ TupleDesc tupledesc,
455
+ const TupleTableSlotOps *tts_ops);
456
+ extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate, TupleDesc tupType,
457
+ const TupleTableSlotOps *tts_ops);
458
+ extern TupleDesc ExecTypeFromTL(List *targetList);
459
+ extern TupleDesc ExecCleanTypeFromTL(List *targetList);
460
+ extern TupleDesc ExecTypeFromExprList(List *exprList);
461
+ extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList);
462
+ extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg);
463
+
464
+ typedef struct TupOutputState
465
+ {
466
+ TupleTableSlot *slot;
467
+ DestReceiver *dest;
468
+ } TupOutputState;
469
+
470
+ extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest,
471
+ TupleDesc tupdesc,
472
+ const TupleTableSlotOps *tts_ops);
473
+ extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull);
474
+ extern void do_text_output_multiline(TupOutputState *tstate, const char *txt);
475
+ extern void end_tup_output(TupOutputState *tstate);
476
+
477
+ /*
478
+ * Write a single line of text given as a C string.
479
+ *
480
+ * Should only be used with a single-TEXT-attribute tupdesc.
481
+ */
482
+ #define do_text_output_oneline(tstate, str_to_emit) \
483
+ do { \
484
+ Datum values_[1]; \
485
+ bool isnull_[1]; \
486
+ values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
487
+ isnull_[0] = false; \
488
+ do_tup_output(tstate, values_, isnull_); \
489
+ pfree(DatumGetPointer(values_[0])); \
490
+ } while (0)
491
+
492
+
493
+ /*
494
+ * prototypes from functions in execUtils.c
495
+ */
496
+ extern EState *CreateExecutorState(void);
497
+ extern void FreeExecutorState(EState *estate);
498
+ extern ExprContext *CreateExprContext(EState *estate);
499
+ extern ExprContext *CreateWorkExprContext(EState *estate);
500
+ extern ExprContext *CreateStandaloneExprContext(void);
501
+ extern void FreeExprContext(ExprContext *econtext, bool isCommit);
502
+ extern void ReScanExprContext(ExprContext *econtext);
503
+
504
+ #define ResetExprContext(econtext) \
505
+ MemoryContextReset((econtext)->ecxt_per_tuple_memory)
506
+
507
+ extern ExprContext *MakePerTupleExprContext(EState *estate);
508
+
509
+ /* Get an EState's per-output-tuple exprcontext, making it if first use */
510
+ #define GetPerTupleExprContext(estate) \
511
+ ((estate)->es_per_tuple_exprcontext ? \
512
+ (estate)->es_per_tuple_exprcontext : \
513
+ MakePerTupleExprContext(estate))
514
+
515
+ #define GetPerTupleMemoryContext(estate) \
516
+ (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
517
+
518
+ /* Reset an EState's per-output-tuple exprcontext, if one's been created */
519
+ #define ResetPerTupleExprContext(estate) \
520
+ do { \
521
+ if ((estate)->es_per_tuple_exprcontext) \
522
+ ResetExprContext((estate)->es_per_tuple_exprcontext); \
523
+ } while (0)
524
+
525
+ extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
526
+ extern TupleDesc ExecGetResultType(PlanState *planstate);
527
+ extern const TupleTableSlotOps *ExecGetResultSlotOps(PlanState *planstate,
528
+ bool *isfixed);
529
+ extern void ExecAssignProjectionInfo(PlanState *planstate,
530
+ TupleDesc inputDesc);
531
+ extern void ExecConditionalAssignProjectionInfo(PlanState *planstate,
532
+ TupleDesc inputDesc, Index varno);
533
+ extern void ExecFreeExprContext(PlanState *planstate);
534
+ extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
535
+ extern void ExecCreateScanSlotFromOuterPlan(EState *estate,
536
+ ScanState *scanstate,
537
+ const TupleTableSlotOps *tts_ops);
538
+
539
+ extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid);
540
+
541
+ extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags);
542
+
543
+ extern void ExecInitRangeTable(EState *estate, List *rangeTable);
544
+
545
+ static inline RangeTblEntry *
546
+ exec_rt_fetch(Index rti, EState *estate)
547
+ {
548
+ return (RangeTblEntry *) list_nth(estate->es_range_table, rti - 1);
549
+ }
550
+
551
+ extern Relation ExecGetRangeTableRelation(EState *estate, Index rti);
552
+
553
+ extern int executor_errposition(EState *estate, int location);
554
+
555
+ extern void RegisterExprContextCallback(ExprContext *econtext,
556
+ ExprContextCallbackFunction function,
557
+ Datum arg);
558
+ extern void UnregisterExprContextCallback(ExprContext *econtext,
559
+ ExprContextCallbackFunction function,
560
+ Datum arg);
561
+
562
+ extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname,
563
+ bool *isNull);
564
+ extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno,
565
+ bool *isNull);
566
+
567
+ extern int ExecTargetListLength(List *targetlist);
568
+ extern int ExecCleanTargetListLength(List *targetlist);
569
+
570
+ extern TupleTableSlot *ExecGetTriggerOldSlot(EState *estate, ResultRelInfo *relInfo);
571
+ extern TupleTableSlot *ExecGetTriggerNewSlot(EState *estate, ResultRelInfo *relInfo);
572
+ extern TupleTableSlot *ExecGetReturningSlot(EState *estate, ResultRelInfo *relInfo);
573
+
574
+ extern Bitmapset *ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate);
575
+ extern Bitmapset *ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate);
576
+ extern Bitmapset *ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate);
577
+ extern Bitmapset *ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate);
578
+
579
+ /*
580
+ * prototypes from functions in execIndexing.c
581
+ */
582
+ extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative);
583
+ extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
584
+ extern List *ExecInsertIndexTuples(TupleTableSlot *slot, EState *estate, bool noDupErr,
585
+ bool *specConflict, List *arbiterIndexes);
586
+ extern bool ExecCheckIndexConstraints(TupleTableSlot *slot, EState *estate,
587
+ ItemPointer conflictTid, List *arbiterIndexes);
588
+ extern void check_exclusion_constraint(Relation heap, Relation index,
589
+ IndexInfo *indexInfo,
590
+ ItemPointer tupleid,
591
+ Datum *values, bool *isnull,
592
+ EState *estate, bool newIndex);
593
+
594
+ /*
595
+ * prototypes from functions in execReplication.c
596
+ */
597
+ extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
598
+ LockTupleMode lockmode,
599
+ TupleTableSlot *searchslot,
600
+ TupleTableSlot *outslot);
601
+ extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode,
602
+ TupleTableSlot *searchslot, TupleTableSlot *outslot);
603
+
604
+ extern void ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot);
605
+ extern void ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
606
+ TupleTableSlot *searchslot, TupleTableSlot *slot);
607
+ extern void ExecSimpleRelationDelete(EState *estate, EPQState *epqstate,
608
+ TupleTableSlot *searchslot);
609
+ extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd);
610
+
611
+ extern void CheckSubscriptionRelkind(char relkind, const char *nspname,
612
+ const char *relname);
613
+
614
+ #endif /* EXECUTOR_H */