pg_query 2.0.3 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (557) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +165 -0
  3. data/README.md +67 -29
  4. data/Rakefile +8 -23
  5. data/ext/pg_query/extconf.rb +21 -3
  6. data/ext/pg_query/include/pg_query.h +29 -4
  7. data/ext/pg_query/include/pg_query_enum_defs.c +551 -272
  8. data/ext/pg_query/include/pg_query_fingerprint_conds.c +563 -470
  9. data/ext/pg_query/include/pg_query_fingerprint_defs.c +5403 -3945
  10. data/ext/pg_query/include/pg_query_outfuncs_conds.c +402 -330
  11. data/ext/pg_query/include/pg_query_outfuncs_defs.c +1319 -1059
  12. data/ext/pg_query/include/pg_query_readfuncs_conds.c +141 -118
  13. data/ext/pg_query/include/pg_query_readfuncs_defs.c +1685 -1379
  14. data/ext/pg_query/include/{access → postgres/access}/amapi.h +47 -1
  15. data/ext/pg_query/include/{access → postgres/access}/attmap.h +5 -3
  16. data/ext/pg_query/include/{access → postgres/access}/attnum.h +2 -2
  17. data/ext/pg_query/include/{access → postgres/access}/clog.h +4 -2
  18. data/ext/pg_query/include/{access → postgres/access}/commit_ts.h +6 -9
  19. data/ext/pg_query/include/{access → postgres/access}/detoast.h +1 -11
  20. data/ext/pg_query/include/{access → postgres/access}/genam.h +21 -16
  21. data/ext/pg_query/include/{access → postgres/access}/gin.h +17 -4
  22. data/ext/pg_query/include/{access → postgres/access}/htup.h +1 -1
  23. data/ext/pg_query/include/{access → postgres/access}/htup_details.h +80 -88
  24. data/ext/pg_query/include/{access → postgres/access}/itup.h +61 -52
  25. data/ext/pg_query/include/{access → postgres/access}/parallel.h +2 -2
  26. data/ext/pg_query/include/{access → postgres/access}/printtup.h +1 -1
  27. data/ext/pg_query/include/{access → postgres/access}/relation.h +1 -1
  28. data/ext/pg_query/include/{access → postgres/access}/relscan.h +17 -2
  29. data/ext/pg_query/include/postgres/access/rmgr.h +62 -0
  30. data/ext/pg_query/include/{access → postgres/access}/rmgrlist.h +24 -24
  31. data/ext/pg_query/include/{access → postgres/access}/sdir.h +12 -3
  32. data/ext/pg_query/include/{access → postgres/access}/skey.h +1 -1
  33. data/ext/pg_query/include/{access → postgres/access}/stratnum.h +4 -2
  34. data/ext/pg_query/include/{access → postgres/access}/sysattr.h +1 -1
  35. data/ext/pg_query/include/{access → postgres/access}/table.h +2 -1
  36. data/ext/pg_query/include/{access → postgres/access}/tableam.h +337 -62
  37. data/ext/pg_query/include/postgres/access/toast_compression.h +73 -0
  38. data/ext/pg_query/include/{access → postgres/access}/transam.h +123 -13
  39. data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
  40. data/ext/pg_query/include/{access → postgres/access}/tupconvert.h +5 -2
  41. data/ext/pg_query/include/{access → postgres/access}/tupdesc.h +2 -2
  42. data/ext/pg_query/include/{access → postgres/access}/tupmacs.h +60 -100
  43. data/ext/pg_query/include/{access → postgres/access}/twophase.h +5 -1
  44. data/ext/pg_query/include/{access → postgres/access}/xact.h +99 -32
  45. data/ext/pg_query/include/{access → postgres/access}/xlog.h +69 -165
  46. data/ext/pg_query/include/{access → postgres/access}/xlog_internal.h +147 -73
  47. data/ext/pg_query/include/postgres/access/xlogbackup.h +41 -0
  48. data/ext/pg_query/include/{access → postgres/access}/xlogdefs.h +13 -40
  49. data/ext/pg_query/include/postgres/access/xlogprefetcher.h +55 -0
  50. data/ext/pg_query/include/{access → postgres/access}/xlogreader.h +154 -37
  51. data/ext/pg_query/include/{access → postgres/access}/xlogrecord.h +34 -13
  52. data/ext/pg_query/include/postgres/access/xlogrecovery.h +158 -0
  53. data/ext/pg_query/include/postgres/archive/archive_module.h +59 -0
  54. data/ext/pg_query/include/{c.h → postgres/c.h} +245 -188
  55. data/ext/pg_query/include/{catalog → postgres/catalog}/catalog.h +6 -3
  56. data/ext/pg_query/include/{catalog → postgres/catalog}/catversion.h +6 -2
  57. data/ext/pg_query/include/{catalog → postgres/catalog}/dependency.h +14 -19
  58. data/ext/pg_query/include/postgres/catalog/genbki.h +143 -0
  59. data/ext/pg_query/include/{catalog → postgres/catalog}/index.h +20 -5
  60. data/ext/pg_query/include/postgres/catalog/indexing.h +54 -0
  61. data/ext/pg_query/include/{catalog → postgres/catalog}/namespace.h +5 -3
  62. data/ext/pg_query/include/{catalog → postgres/catalog}/objectaccess.h +73 -3
  63. data/ext/pg_query/include/{catalog → postgres/catalog}/objectaddress.h +12 -7
  64. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate.h +14 -10
  65. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate_d.h +2 -1
  66. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am.h +4 -1
  67. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am_d.h +3 -1
  68. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute.h +45 -26
  69. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute_d.h +19 -16
  70. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid.h +7 -2
  71. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid_d.h +19 -9
  72. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class.h +45 -15
  73. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class_d.h +31 -2
  74. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation.h +35 -8
  75. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation_d.h +21 -3
  76. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint.h +39 -13
  77. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint_d.h +10 -4
  78. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_control.h +13 -5
  79. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion.h +8 -5
  80. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion_d.h +4 -1
  81. data/ext/pg_query/include/postgres/catalog/pg_database.h +124 -0
  82. data/ext/pg_query/include/postgres/catalog/pg_database_d.h +52 -0
  83. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend.h +11 -7
  84. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend_d.h +3 -1
  85. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger.h +9 -3
  86. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger_d.h +3 -1
  87. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index.h +17 -7
  88. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index_d.h +20 -17
  89. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language.h +10 -5
  90. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language_d.h +3 -1
  91. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace.h +7 -2
  92. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace_d.h +3 -1
  93. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass.h +8 -5
  94. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass_d.h +3 -1
  95. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator.h +21 -16
  96. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator_d.h +37 -1
  97. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily.h +8 -4
  98. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily_d.h +6 -2
  99. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table.h +20 -9
  100. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table_d.h +2 -1
  101. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc.h +20 -11
  102. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc_d.h +10 -8
  103. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication.h +49 -6
  104. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication_d.h +3 -1
  105. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin.h +6 -1
  106. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin_d.h +5 -1
  107. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic.h +19 -12
  108. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_d.h +2 -1
  109. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext.h +19 -5
  110. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext_d.h +7 -2
  111. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform.h +8 -5
  112. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform_d.h +3 -1
  113. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger.h +24 -8
  114. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger_d.h +4 -1
  115. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config.h +6 -3
  116. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config_d.h +3 -1
  117. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict.h +8 -3
  118. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict_d.h +3 -1
  119. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser.h +6 -3
  120. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser_d.h +3 -1
  121. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template.h +6 -3
  122. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template_d.h +3 -1
  123. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type.h +56 -24
  124. data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type_d.h +70 -31
  125. data/ext/pg_query/include/{catalog → postgres/catalog}/storage.h +9 -7
  126. data/ext/pg_query/include/{commands → postgres/commands}/async.h +4 -5
  127. data/ext/pg_query/include/{commands → postgres/commands}/dbcommands.h +3 -1
  128. data/ext/pg_query/include/{commands → postgres/commands}/defrem.h +12 -24
  129. data/ext/pg_query/include/{commands → postgres/commands}/event_trigger.h +2 -2
  130. data/ext/pg_query/include/{commands → postgres/commands}/explain.h +3 -1
  131. data/ext/pg_query/include/{commands → postgres/commands}/prepare.h +1 -1
  132. data/ext/pg_query/include/{commands → postgres/commands}/tablespace.h +6 -4
  133. data/ext/pg_query/include/{commands → postgres/commands}/trigger.h +36 -25
  134. data/ext/pg_query/include/{commands → postgres/commands}/user.h +10 -4
  135. data/ext/pg_query/include/{commands → postgres/commands}/vacuum.h +140 -47
  136. data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
  137. data/ext/pg_query/include/{common → postgres/common}/file_perm.h +4 -4
  138. data/ext/pg_query/include/{common → postgres/common}/hashfn.h +1 -1
  139. data/ext/pg_query/include/postgres/common/int.h +437 -0
  140. data/ext/pg_query/include/{common → postgres/common}/keywords.h +2 -6
  141. data/ext/pg_query/include/{common → postgres/common}/kwlookup.h +2 -2
  142. data/ext/pg_query/include/postgres/common/pg_prng.h +61 -0
  143. data/ext/pg_query/include/{common → postgres/common}/relpath.h +21 -14
  144. data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
  145. data/ext/pg_query/include/postgres/common/sha2.h +32 -0
  146. data/ext/pg_query/include/postgres/common/string.h +44 -0
  147. data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +125 -0
  148. data/ext/pg_query/include/{common/unicode_combining_table.h → postgres/common/unicode_nonspacing_table.h} +138 -8
  149. data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5013 -0
  150. data/ext/pg_query/include/postgres/copyfuncs.switch.c +938 -0
  151. data/ext/pg_query/include/{datatype → postgres/datatype}/timestamp.h +50 -4
  152. data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3097 -0
  153. data/ext/pg_query/include/postgres/equalfuncs.switch.c +785 -0
  154. data/ext/pg_query/include/{executor → postgres/executor}/execdesc.h +1 -1
  155. data/ext/pg_query/include/{executor → postgres/executor}/executor.h +98 -32
  156. data/ext/pg_query/include/{executor → postgres/executor}/functions.h +17 -3
  157. data/ext/pg_query/include/{executor → postgres/executor}/instrument.h +33 -16
  158. data/ext/pg_query/include/{executor → postgres/executor}/spi.h +42 -4
  159. data/ext/pg_query/include/{executor → postgres/executor}/tablefunc.h +1 -1
  160. data/ext/pg_query/include/{executor → postgres/executor}/tuptable.h +18 -11
  161. data/ext/pg_query/include/{fmgr.h → postgres/fmgr.h} +33 -8
  162. data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
  163. data/ext/pg_query/include/{funcapi.h → postgres/funcapi.h} +22 -10
  164. data/ext/pg_query/include/postgres/gram.h +1127 -0
  165. data/ext/pg_query/include/{parser → postgres}/gramparse.h +4 -4
  166. data/ext/pg_query/include/{jit → postgres/jit}/jit.h +12 -12
  167. data/ext/pg_query/include/postgres/kwlist_d.h +1119 -0
  168. data/ext/pg_query/include/postgres/lib/dshash.h +115 -0
  169. data/ext/pg_query/include/{lib → postgres/lib}/ilist.h +454 -22
  170. data/ext/pg_query/include/{lib → postgres/lib}/pairingheap.h +1 -1
  171. data/ext/pg_query/include/{lib → postgres/lib}/simplehash.h +158 -33
  172. data/ext/pg_query/include/postgres/lib/sort_template.h +432 -0
  173. data/ext/pg_query/include/{lib → postgres/lib}/stringinfo.h +3 -3
  174. data/ext/pg_query/include/{libpq → postgres/libpq}/auth.h +12 -4
  175. data/ext/pg_query/include/{libpq → postgres/libpq}/crypt.h +5 -4
  176. data/ext/pg_query/include/{libpq → postgres/libpq}/hba.h +54 -8
  177. data/ext/pg_query/include/{libpq → postgres/libpq}/libpq-be.h +45 -17
  178. data/ext/pg_query/include/{libpq → postgres/libpq}/libpq.h +31 -20
  179. data/ext/pg_query/include/{libpq → postgres/libpq}/pqcomm.h +26 -71
  180. data/ext/pg_query/include/{libpq → postgres/libpq}/pqformat.h +2 -2
  181. data/ext/pg_query/include/{libpq → postgres/libpq}/pqsignal.h +25 -13
  182. data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
  183. data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
  184. data/ext/pg_query/include/{mb → postgres/mb}/pg_wchar.h +125 -25
  185. data/ext/pg_query/include/{mb → postgres/mb}/stringinfo_mb.h +1 -1
  186. data/ext/pg_query/include/{miscadmin.h → postgres/miscadmin.h} +96 -65
  187. data/ext/pg_query/include/{nodes → postgres/nodes}/bitmapset.h +11 -7
  188. data/ext/pg_query/include/{nodes → postgres/nodes}/execnodes.h +351 -103
  189. data/ext/pg_query/include/{nodes → postgres/nodes}/extensible.h +8 -4
  190. data/ext/pg_query/include/{nodes → postgres/nodes}/lockoptions.h +1 -1
  191. data/ext/pg_query/include/{nodes → postgres/nodes}/makefuncs.h +19 -6
  192. data/ext/pg_query/include/{nodes → postgres/nodes}/memnodes.h +11 -6
  193. data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
  194. data/ext/pg_query/include/{nodes → postgres/nodes}/nodeFuncs.h +89 -29
  195. data/ext/pg_query/include/{nodes → postgres/nodes}/nodes.h +100 -496
  196. data/ext/pg_query/include/postgres/nodes/nodetags.h +471 -0
  197. data/ext/pg_query/include/{nodes → postgres/nodes}/params.h +3 -3
  198. data/ext/pg_query/include/{nodes → postgres/nodes}/parsenodes.h +678 -207
  199. data/ext/pg_query/include/{nodes → postgres/nodes}/pathnodes.h +1282 -454
  200. data/ext/pg_query/include/{nodes → postgres/nodes}/pg_list.h +103 -73
  201. data/ext/pg_query/include/{nodes → postgres/nodes}/plannodes.h +474 -133
  202. data/ext/pg_query/include/{nodes → postgres/nodes}/primnodes.h +754 -254
  203. data/ext/pg_query/include/{nodes → postgres/nodes}/print.h +1 -1
  204. data/ext/pg_query/include/postgres/nodes/queryjumble.h +86 -0
  205. data/ext/pg_query/include/postgres/nodes/replnodes.h +111 -0
  206. data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
  207. data/ext/pg_query/include/{nodes → postgres/nodes}/tidbitmap.h +1 -1
  208. data/ext/pg_query/include/postgres/nodes/value.h +90 -0
  209. data/ext/pg_query/include/{optimizer → postgres/optimizer}/cost.h +14 -5
  210. data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo.h +9 -7
  211. data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo_gene.h +1 -1
  212. data/ext/pg_query/include/{optimizer → postgres/optimizer}/optimizer.h +31 -28
  213. data/ext/pg_query/include/{optimizer → postgres/optimizer}/paths.h +29 -12
  214. data/ext/pg_query/include/{optimizer → postgres/optimizer}/planmain.h +15 -17
  215. data/ext/pg_query/include/{parser → postgres/parser}/analyze.h +20 -5
  216. data/ext/pg_query/include/postgres/parser/kwlist.h +498 -0
  217. data/ext/pg_query/include/{parser → postgres/parser}/parse_agg.h +5 -8
  218. data/ext/pg_query/include/{parser → postgres/parser}/parse_coerce.h +6 -1
  219. data/ext/pg_query/include/{parser → postgres/parser}/parse_expr.h +2 -3
  220. data/ext/pg_query/include/{parser → postgres/parser}/parse_func.h +2 -1
  221. data/ext/pg_query/include/{parser → postgres/parser}/parse_node.h +41 -11
  222. data/ext/pg_query/include/{parser → postgres/parser}/parse_oper.h +3 -5
  223. data/ext/pg_query/include/{parser → postgres/parser}/parse_relation.h +11 -5
  224. data/ext/pg_query/include/{parser → postgres/parser}/parse_type.h +4 -3
  225. data/ext/pg_query/include/postgres/parser/parser.h +68 -0
  226. data/ext/pg_query/include/{parser → postgres/parser}/parsetree.h +1 -1
  227. data/ext/pg_query/include/{parser → postgres/parser}/scanner.h +2 -2
  228. data/ext/pg_query/include/{parser → postgres/parser}/scansup.h +2 -5
  229. data/ext/pg_query/include/{partitioning → postgres/partitioning}/partdefs.h +1 -1
  230. data/ext/pg_query/include/{pg_config.h → postgres/pg_config.h} +216 -228
  231. data/ext/pg_query/include/{pg_config_manual.h → postgres/pg_config_manual.h} +80 -58
  232. data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
  233. data/ext/pg_query/include/{pg_getopt.h → postgres/pg_getopt.h} +6 -6
  234. data/ext/pg_query/include/{pg_trace.h → postgres/pg_trace.h} +1 -1
  235. data/ext/pg_query/include/postgres/pgstat.h +778 -0
  236. data/ext/pg_query/include/{pgtime.h → postgres/pgtime.h} +16 -6
  237. data/ext/pg_query/include/{pl_gram.h → postgres/pl_gram.h} +116 -116
  238. data/ext/pg_query/include/{pl_reserved_kwlist.h → postgres/pl_reserved_kwlist.h} +1 -1
  239. data/ext/pg_query/include/{pl_reserved_kwlist_d.h → postgres/pl_reserved_kwlist_d.h} +10 -10
  240. data/ext/pg_query/include/{pl_unreserved_kwlist.h → postgres/pl_unreserved_kwlist.h} +3 -3
  241. data/ext/pg_query/include/{pl_unreserved_kwlist_d.h → postgres/pl_unreserved_kwlist_d.h} +60 -60
  242. data/ext/pg_query/include/{plerrcodes.h → postgres/plerrcodes.h} +9 -1
  243. data/ext/pg_query/include/{plpgsql.h → postgres/plpgsql.h} +79 -86
  244. data/ext/pg_query/include/{port → postgres/port}/atomics/arch-arm.h +9 -3
  245. data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
  246. data/ext/pg_query/include/{port → postgres/port}/atomics/arch-ppc.h +21 -21
  247. data/ext/pg_query/include/{port → postgres/port}/atomics/arch-x86.h +2 -2
  248. data/ext/pg_query/include/{port → postgres/port}/atomics/fallback.h +3 -3
  249. data/ext/pg_query/include/{port → postgres/port}/atomics/generic-gcc.h +3 -3
  250. data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +101 -0
  251. data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +106 -0
  252. data/ext/pg_query/include/{port → postgres/port}/atomics/generic.h +1 -1
  253. data/ext/pg_query/include/{port → postgres/port}/atomics.h +2 -7
  254. data/ext/pg_query/include/{port → postgres/port}/pg_bitutils.h +129 -16
  255. data/ext/pg_query/include/{port → postgres/port}/pg_bswap.h +1 -1
  256. data/ext/pg_query/include/{port → postgres/port}/pg_crc32c.h +1 -1
  257. data/ext/pg_query/include/postgres/port/simd.h +375 -0
  258. data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
  259. data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
  260. data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
  261. data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
  262. data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
  263. data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
  264. data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
  265. data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
  266. data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
  267. data/ext/pg_query/include/postgres/port/win32/sys/socket.h +26 -0
  268. data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
  269. data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
  270. data/ext/pg_query/include/postgres/port/win32.h +59 -0
  271. data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
  272. data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
  273. data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
  274. data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
  275. data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
  276. data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
  277. data/ext/pg_query/include/postgres/port/win32_port.h +594 -0
  278. data/ext/pg_query/include/{port.h → postgres/port.h} +107 -111
  279. data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
  280. data/ext/pg_query/include/postgres/postgres.h +579 -0
  281. data/ext/pg_query/include/{postgres_ext.h → postgres/postgres_ext.h} +0 -1
  282. data/ext/pg_query/include/{postmaster → postgres/postmaster}/autovacuum.h +17 -20
  283. data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker.h +3 -2
  284. data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker_internals.h +2 -2
  285. data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgwriter.h +6 -6
  286. data/ext/pg_query/include/{postmaster → postgres/postmaster}/interrupt.h +1 -1
  287. data/ext/pg_query/include/{postmaster → postgres/postmaster}/pgarch.h +7 -10
  288. data/ext/pg_query/include/{postmaster → postgres/postmaster}/postmaster.h +21 -17
  289. data/ext/pg_query/include/postgres/postmaster/startup.h +41 -0
  290. data/ext/pg_query/include/{postmaster → postgres/postmaster}/syslogger.h +16 -11
  291. data/ext/pg_query/include/{postmaster → postgres/postmaster}/walwriter.h +5 -3
  292. data/ext/pg_query/include/{regex → postgres/regex}/regex.h +27 -22
  293. data/ext/pg_query/include/{replication → postgres/replication}/logicallauncher.h +8 -5
  294. data/ext/pg_query/include/postgres/replication/logicalproto.h +274 -0
  295. data/ext/pg_query/include/postgres/replication/logicalworker.h +32 -0
  296. data/ext/pg_query/include/{replication → postgres/replication}/origin.h +8 -8
  297. data/ext/pg_query/include/postgres/replication/reorderbuffer.h +753 -0
  298. data/ext/pg_query/include/{replication → postgres/replication}/slot.h +42 -12
  299. data/ext/pg_query/include/{replication → postgres/replication}/syncrep.h +6 -12
  300. data/ext/pg_query/include/{replication → postgres/replication}/walreceiver.h +158 -20
  301. data/ext/pg_query/include/{replication → postgres/replication}/walsender.h +20 -20
  302. data/ext/pg_query/include/{rewrite → postgres/rewrite}/prs2lock.h +1 -1
  303. data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteHandler.h +1 -6
  304. data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteManip.h +11 -2
  305. data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteSupport.h +1 -1
  306. data/ext/pg_query/include/{storage → postgres/storage}/backendid.h +3 -3
  307. data/ext/pg_query/include/{storage → postgres/storage}/block.h +24 -37
  308. data/ext/pg_query/include/{storage → postgres/storage}/buf.h +1 -1
  309. data/ext/pg_query/include/{storage → postgres/storage}/bufmgr.h +196 -95
  310. data/ext/pg_query/include/{storage → postgres/storage}/bufpage.h +152 -101
  311. data/ext/pg_query/include/{storage → postgres/storage}/condition_variable.h +14 -3
  312. data/ext/pg_query/include/{storage → postgres/storage}/dsm.h +6 -6
  313. data/ext/pg_query/include/{storage → postgres/storage}/dsm_impl.h +6 -2
  314. data/ext/pg_query/include/{storage → postgres/storage}/fd.h +48 -14
  315. data/ext/pg_query/include/postgres/storage/fileset.h +40 -0
  316. data/ext/pg_query/include/{storage → postgres/storage}/ipc.h +5 -2
  317. data/ext/pg_query/include/{storage → postgres/storage}/item.h +1 -1
  318. data/ext/pg_query/include/{storage → postgres/storage}/itemid.h +1 -1
  319. data/ext/pg_query/include/{storage → postgres/storage}/itemptr.h +96 -57
  320. data/ext/pg_query/include/{storage → postgres/storage}/large_object.h +2 -2
  321. data/ext/pg_query/include/{storage → postgres/storage}/latch.h +17 -13
  322. data/ext/pg_query/include/{storage → postgres/storage}/lmgr.h +7 -1
  323. data/ext/pg_query/include/{storage → postgres/storage}/lock.h +37 -25
  324. data/ext/pg_query/include/{storage → postgres/storage}/lockdefs.h +4 -4
  325. data/ext/pg_query/include/{storage → postgres/storage}/lwlock.h +21 -33
  326. data/ext/pg_query/include/{storage → postgres/storage}/lwlocknames.h +0 -1
  327. data/ext/pg_query/include/{storage → postgres/storage}/off.h +1 -1
  328. data/ext/pg_query/include/{storage → postgres/storage}/pg_sema.h +1 -1
  329. data/ext/pg_query/include/{storage → postgres/storage}/pg_shmem.h +9 -7
  330. data/ext/pg_query/include/{storage → postgres/storage}/pmsignal.h +15 -4
  331. data/ext/pg_query/include/{storage → postgres/storage}/predicate.h +5 -5
  332. data/ext/pg_query/include/{storage → postgres/storage}/proc.h +200 -67
  333. data/ext/pg_query/include/postgres/storage/procarray.h +99 -0
  334. data/ext/pg_query/include/{storage → postgres/storage}/proclist_types.h +1 -1
  335. data/ext/pg_query/include/{storage → postgres/storage}/procsignal.h +5 -7
  336. data/ext/pg_query/include/postgres/storage/relfilelocator.h +99 -0
  337. data/ext/pg_query/include/{storage → postgres/storage}/s_lock.h +118 -298
  338. data/ext/pg_query/include/{storage → postgres/storage}/sharedfileset.h +3 -11
  339. data/ext/pg_query/include/{storage → postgres/storage}/shm_mq.h +5 -4
  340. data/ext/pg_query/include/{storage → postgres/storage}/shm_toc.h +1 -1
  341. data/ext/pg_query/include/{storage → postgres/storage}/shmem.h +1 -23
  342. data/ext/pg_query/include/{storage → postgres/storage}/sinval.h +5 -5
  343. data/ext/pg_query/include/{storage → postgres/storage}/sinvaladt.h +4 -2
  344. data/ext/pg_query/include/{storage → postgres/storage}/smgr.h +21 -17
  345. data/ext/pg_query/include/{storage → postgres/storage}/spin.h +2 -2
  346. data/ext/pg_query/include/{storage → postgres/storage}/standby.h +17 -9
  347. data/ext/pg_query/include/{storage → postgres/storage}/standbydefs.h +2 -2
  348. data/ext/pg_query/include/{storage → postgres/storage}/sync.h +9 -5
  349. data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtag.h +7 -2
  350. data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtaglist.h +3 -2
  351. data/ext/pg_query/include/{tcop → postgres/tcop}/deparse_utility.h +1 -1
  352. data/ext/pg_query/include/{tcop → postgres/tcop}/dest.h +1 -3
  353. data/ext/pg_query/include/{tcop → postgres/tcop}/fastpath.h +1 -2
  354. data/ext/pg_query/include/{tcop → postgres/tcop}/pquery.h +7 -1
  355. data/ext/pg_query/include/{tcop → postgres/tcop}/tcopprot.h +19 -14
  356. data/ext/pg_query/include/{tcop → postgres/tcop}/utility.h +7 -3
  357. data/ext/pg_query/include/{tsearch → postgres/tsearch}/ts_cache.h +3 -5
  358. data/ext/pg_query/include/{utils → postgres/utils}/acl.h +37 -71
  359. data/ext/pg_query/include/{utils → postgres/utils}/aclchk_internal.h +1 -1
  360. data/ext/pg_query/include/{utils → postgres/utils}/array.h +26 -2
  361. data/ext/pg_query/include/postgres/utils/backend_progress.h +45 -0
  362. data/ext/pg_query/include/postgres/utils/backend_status.h +342 -0
  363. data/ext/pg_query/include/{utils → postgres/utils}/builtins.h +20 -11
  364. data/ext/pg_query/include/{utils → postgres/utils}/bytea.h +3 -2
  365. data/ext/pg_query/include/{utils → postgres/utils}/catcache.h +1 -1
  366. data/ext/pg_query/include/{utils → postgres/utils}/date.h +37 -9
  367. data/ext/pg_query/include/{utils → postgres/utils}/datetime.h +48 -27
  368. data/ext/pg_query/include/{utils → postgres/utils}/datum.h +9 -1
  369. data/ext/pg_query/include/{utils → postgres/utils}/dsa.h +5 -1
  370. data/ext/pg_query/include/{utils → postgres/utils}/elog.h +154 -48
  371. data/ext/pg_query/include/{utils → postgres/utils}/errcodes.h +2 -0
  372. data/ext/pg_query/include/{utils → postgres/utils}/expandeddatum.h +14 -3
  373. data/ext/pg_query/include/{utils → postgres/utils}/expandedrecord.h +14 -4
  374. data/ext/pg_query/include/{utils → postgres/utils}/float.h +13 -12
  375. data/ext/pg_query/include/{utils → postgres/utils}/fmgroids.h +1353 -696
  376. data/ext/pg_query/include/{utils → postgres/utils}/fmgrprotos.h +243 -18
  377. data/ext/pg_query/include/{utils → postgres/utils}/fmgrtab.h +6 -5
  378. data/ext/pg_query/include/{utils → postgres/utils}/guc.h +120 -121
  379. data/ext/pg_query/include/postgres/utils/guc_hooks.h +163 -0
  380. data/ext/pg_query/include/{utils → postgres/utils}/guc_tables.h +71 -21
  381. data/ext/pg_query/include/{utils → postgres/utils}/hsearch.h +15 -11
  382. data/ext/pg_query/include/{utils → postgres/utils}/inval.h +7 -3
  383. data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
  384. data/ext/pg_query/include/{utils → postgres/utils}/lsyscache.h +16 -1
  385. data/ext/pg_query/include/{utils → postgres/utils}/memdebug.h +1 -1
  386. data/ext/pg_query/include/{utils → postgres/utils}/memutils.h +14 -53
  387. data/ext/pg_query/include/postgres/utils/memutils_internal.h +136 -0
  388. data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +237 -0
  389. data/ext/pg_query/include/{utils → postgres/utils}/numeric.h +38 -9
  390. data/ext/pg_query/include/{utils → postgres/utils}/palloc.h +33 -4
  391. data/ext/pg_query/include/{utils → postgres/utils}/partcache.h +3 -2
  392. data/ext/pg_query/include/{utils → postgres/utils}/pg_locale.h +37 -21
  393. data/ext/pg_query/include/postgres/utils/pgstat_internal.h +814 -0
  394. data/ext/pg_query/include/{utils → postgres/utils}/plancache.h +6 -5
  395. data/ext/pg_query/include/{utils → postgres/utils}/portal.h +12 -1
  396. data/ext/pg_query/include/{utils → postgres/utils}/probes.h +59 -59
  397. data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
  398. data/ext/pg_query/include/{utils → postgres/utils}/queryenvironment.h +1 -1
  399. data/ext/pg_query/include/postgres/utils/regproc.h +39 -0
  400. data/ext/pg_query/include/{utils → postgres/utils}/rel.h +129 -61
  401. data/ext/pg_query/include/{utils → postgres/utils}/relcache.h +21 -14
  402. data/ext/pg_query/include/{utils → postgres/utils}/reltrigger.h +1 -1
  403. data/ext/pg_query/include/{utils → postgres/utils}/resowner.h +1 -1
  404. data/ext/pg_query/include/{utils → postgres/utils}/ruleutils.h +9 -1
  405. data/ext/pg_query/include/{utils → postgres/utils}/sharedtuplestore.h +1 -1
  406. data/ext/pg_query/include/{utils → postgres/utils}/snapmgr.h +38 -15
  407. data/ext/pg_query/include/{utils → postgres/utils}/snapshot.h +14 -1
  408. data/ext/pg_query/include/{utils → postgres/utils}/sortsupport.h +117 -2
  409. data/ext/pg_query/include/{utils → postgres/utils}/syscache.h +9 -1
  410. data/ext/pg_query/include/{utils → postgres/utils}/timeout.h +11 -4
  411. data/ext/pg_query/include/{utils → postgres/utils}/timestamp.h +46 -15
  412. data/ext/pg_query/include/{utils → postgres/utils}/tuplesort.h +209 -41
  413. data/ext/pg_query/include/{utils → postgres/utils}/tuplestore.h +2 -2
  414. data/ext/pg_query/include/{utils → postgres/utils}/typcache.h +24 -17
  415. data/ext/pg_query/include/{utils → postgres/utils}/varlena.h +17 -3
  416. data/ext/pg_query/include/postgres/utils/wait_event.h +294 -0
  417. data/ext/pg_query/include/{utils → postgres/utils}/xml.h +18 -8
  418. data/ext/pg_query/include/{postgres.h → postgres/varatt.h} +65 -471
  419. data/ext/pg_query/include/protobuf/pg_query.pb-c.h +7494 -6382
  420. data/ext/pg_query/include/protobuf/pg_query.pb.h +116922 -84792
  421. data/ext/pg_query/include/protobuf-c/protobuf-c.h +7 -3
  422. data/ext/pg_query/include/protobuf-c.h +7 -3
  423. data/ext/pg_query/pg_query.c +10 -1
  424. data/ext/pg_query/pg_query.pb-c.c +21026 -17002
  425. data/ext/pg_query/pg_query_deparse.c +1 -9896
  426. data/ext/pg_query/pg_query_fingerprint.c +162 -50
  427. data/ext/pg_query/pg_query_fingerprint.h +3 -1
  428. data/ext/pg_query/pg_query_internal.h +1 -1
  429. data/ext/pg_query/pg_query_json_plpgsql.c +56 -12
  430. data/ext/pg_query/pg_query_normalize.c +259 -64
  431. data/ext/pg_query/pg_query_outfuncs.h +1 -0
  432. data/ext/pg_query/pg_query_outfuncs_json.c +71 -16
  433. data/ext/pg_query/pg_query_outfuncs_protobuf.c +73 -12
  434. data/ext/pg_query/pg_query_parse.c +47 -5
  435. data/ext/pg_query/pg_query_parse_plpgsql.c +86 -21
  436. data/ext/pg_query/pg_query_readfuncs_protobuf.c +43 -8
  437. data/ext/pg_query/pg_query_ruby.c +6 -1
  438. data/ext/pg_query/pg_query_ruby_freebsd.sym +2 -0
  439. data/ext/pg_query/pg_query_scan.c +3 -2
  440. data/ext/pg_query/pg_query_split.c +6 -5
  441. data/ext/pg_query/postgres_deparse.c +11067 -0
  442. data/ext/pg_query/postgres_deparse.h +9 -0
  443. data/ext/pg_query/protobuf-c.c +34 -27
  444. data/ext/pg_query/src_backend_catalog_namespace.c +27 -10
  445. data/ext/pg_query/src_backend_catalog_pg_proc.c +4 -1
  446. data/ext/pg_query/src_backend_commands_define.c +11 -1
  447. data/ext/pg_query/src_backend_nodes_bitmapset.c +13 -70
  448. data/ext/pg_query/src_backend_nodes_copyfuncs.c +103 -5894
  449. data/ext/pg_query/src_backend_nodes_equalfuncs.c +102 -3830
  450. data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
  451. data/ext/pg_query/src_backend_nodes_list.c +99 -12
  452. data/ext/pg_query/src_backend_nodes_makefuncs.c +99 -4
  453. data/ext/pg_query/src_backend_nodes_nodeFuncs.c +325 -131
  454. data/ext/pg_query/src_backend_nodes_nodes.c +38 -0
  455. data/ext/pg_query/src_backend_nodes_value.c +28 -19
  456. data/ext/pg_query/src_backend_parser_gram.c +36104 -32074
  457. data/ext/pg_query/src_backend_parser_parser.c +53 -8
  458. data/ext/pg_query/src_backend_parser_scan.c +4893 -3701
  459. data/ext/pg_query/src_backend_parser_scansup.c +4 -28
  460. data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
  461. data/ext/pg_query/src_backend_tcop_postgres.c +133 -105
  462. data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
  463. data/ext/pg_query/src_backend_utils_adt_datum.c +17 -7
  464. data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
  465. data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
  466. data/ext/pg_query/src_backend_utils_adt_numutils.c +489 -0
  467. data/ext/pg_query/src_backend_utils_adt_ruleutils.c +187 -19
  468. data/ext/pg_query/src_backend_utils_error_assert.c +17 -18
  469. data/ext/pg_query/src_backend_utils_error_elog.c +513 -318
  470. data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +44 -17
  471. data/ext/pg_query/src_backend_utils_init_globals.c +9 -6
  472. data/ext/pg_query/src_backend_utils_mb_mbutils.c +74 -131
  473. data/ext/pg_query/src_backend_utils_misc_guc_tables.c +492 -0
  474. data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +163 -0
  475. data/ext/pg_query/src_backend_utils_mmgr_aset.c +453 -314
  476. data/ext/pg_query/src_backend_utils_mmgr_generation.c +1039 -0
  477. data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +549 -76
  478. data/ext/pg_query/src_backend_utils_mmgr_slab.c +1021 -0
  479. data/ext/pg_query/src_common_encnames.c +4 -1
  480. data/ext/pg_query/src_common_hashfn.c +420 -0
  481. data/ext/pg_query/src_common_keywords.c +15 -2
  482. data/ext/pg_query/src_common_kwlist_d.h +545 -498
  483. data/ext/pg_query/src_common_kwlookup.c +1 -1
  484. data/ext/pg_query/src_common_psprintf.c +1 -1
  485. data/ext/pg_query/src_common_stringinfo.c +4 -4
  486. data/ext/pg_query/src_common_wchar.c +717 -113
  487. data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +49 -22
  488. data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -18
  489. data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1136 -1195
  490. data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
  491. data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +10 -10
  492. data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +2 -2
  493. data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +60 -60
  494. data/ext/pg_query/src_port_pg_bitutils.c +103 -40
  495. data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
  496. data/ext/pg_query/src_port_qsort.c +12 -224
  497. data/ext/pg_query/src_port_snprintf.c +51 -29
  498. data/ext/pg_query/src_port_strerror.c +9 -19
  499. data/ext/pg_query/src_port_strlcpy.c +79 -0
  500. data/lib/pg_query/deparse.rb +7 -1
  501. data/lib/pg_query/filter_columns.rb +7 -5
  502. data/lib/pg_query/fingerprint.rb +21 -9
  503. data/lib/pg_query/node.rb +18 -13
  504. data/lib/pg_query/param_refs.rb +1 -1
  505. data/lib/pg_query/parse.rb +141 -50
  506. data/lib/pg_query/pg_query_pb.rb +175 -3031
  507. data/lib/pg_query/treewalker.rb +26 -2
  508. data/lib/pg_query/truncate.rb +54 -8
  509. data/lib/pg_query/version.rb +1 -1
  510. data/lib/pg_query.rb +0 -1
  511. metadata +443 -380
  512. data/ext/pg_query/guc-file.c +0 -0
  513. data/ext/pg_query/include/access/rmgr.h +0 -35
  514. data/ext/pg_query/include/access/xloginsert.h +0 -64
  515. data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
  516. data/ext/pg_query/include/catalog/genbki.h +0 -64
  517. data/ext/pg_query/include/catalog/indexing.h +0 -366
  518. data/ext/pg_query/include/commands/variable.h +0 -38
  519. data/ext/pg_query/include/common/ip.h +0 -37
  520. data/ext/pg_query/include/common/string.h +0 -19
  521. data/ext/pg_query/include/getaddrinfo.h +0 -162
  522. data/ext/pg_query/include/kwlist_d.h +0 -1072
  523. data/ext/pg_query/include/nodes/value.h +0 -61
  524. data/ext/pg_query/include/parser/gram.h +0 -1067
  525. data/ext/pg_query/include/parser/kwlist.h +0 -477
  526. data/ext/pg_query/include/parser/parse_clause.h +0 -54
  527. data/ext/pg_query/include/parser/parse_collate.h +0 -27
  528. data/ext/pg_query/include/parser/parse_target.h +0 -46
  529. data/ext/pg_query/include/parser/parser.h +0 -41
  530. data/ext/pg_query/include/pg_config_os.h +0 -8
  531. data/ext/pg_query/include/pgstat.h +0 -1487
  532. data/ext/pg_query/include/portability/instr_time.h +0 -256
  533. data/ext/pg_query/include/postmaster/fork_process.h +0 -17
  534. data/ext/pg_query/include/replication/logicalproto.h +0 -110
  535. data/ext/pg_query/include/replication/logicalworker.h +0 -19
  536. data/ext/pg_query/include/replication/reorderbuffer.h +0 -467
  537. data/ext/pg_query/include/storage/relfilenode.h +0 -99
  538. data/ext/pg_query/include/utils/dynahash.h +0 -19
  539. data/ext/pg_query/include/utils/pg_lsn.h +0 -29
  540. data/ext/pg_query/include/utils/pidfile.h +0 -56
  541. data/ext/pg_query/include/utils/ps_status.h +0 -25
  542. data/ext/pg_query/include/utils/regproc.h +0 -28
  543. data/ext/pg_query/include/utils/rls.h +0 -50
  544. data/ext/pg_query/include/utils/tzparser.h +0 -39
  545. data/ext/pg_query/src_backend_libpq_pqcomm.c +0 -651
  546. data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
  547. data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2230
  548. data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -370
  549. data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1086
  550. data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1831
  551. data/ext/pg_query/src_common_string.c +0 -86
  552. data/ext/pg_query/src_port_erand48.c +0 -127
  553. data/ext/pg_query/src_port_pgsleep.c +0 -69
  554. data/ext/pg_query/src_port_random.c +0 -31
  555. data/ext/pg_query/src_port_strnlen.c +0 -39
  556. data/lib/pg_query/json_field_names.rb +0 -1402
  557. /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
@@ -1,1831 +0,0 @@
1
- /*--------------------------------------------------------------------
2
- * Symbols referenced in this file:
3
- * - log_min_messages
4
- * - client_min_messages
5
- * - backtrace_functions
6
- * - backtrace_symbol_list
7
- * - check_function_bodies
8
- *--------------------------------------------------------------------
9
- */
10
-
11
- /*--------------------------------------------------------------------
12
- * guc.c
13
- *
14
- * Support for grand unified configuration scheme, including SET
15
- * command, configuration file, and command line options.
16
- * See src/backend/utils/misc/README for more information.
17
- *
18
- *
19
- * Copyright (c) 2000-2020, PostgreSQL Global Development Group
20
- * Written by Peter Eisentraut <peter_e@gmx.net>.
21
- *
22
- * IDENTIFICATION
23
- * src/backend/utils/misc/guc.c
24
- *
25
- *--------------------------------------------------------------------
26
- */
27
- #include "postgres.h"
28
-
29
- #include <ctype.h>
30
- #include <float.h>
31
- #include <math.h>
32
- #include <limits.h>
33
- #include <unistd.h>
34
- #include <sys/stat.h>
35
- #ifdef HAVE_SYSLOG
36
- #include <syslog.h>
37
- #endif
38
-
39
- #include "access/commit_ts.h"
40
- #include "access/gin.h"
41
- #include "access/rmgr.h"
42
- #include "access/tableam.h"
43
- #include "access/transam.h"
44
- #include "access/twophase.h"
45
- #include "access/xact.h"
46
- #include "access/xlog_internal.h"
47
- #include "catalog/namespace.h"
48
- #include "catalog/pg_authid.h"
49
- #include "catalog/storage.h"
50
- #include "commands/async.h"
51
- #include "commands/prepare.h"
52
- #include "commands/trigger.h"
53
- #include "commands/user.h"
54
- #include "commands/vacuum.h"
55
- #include "commands/variable.h"
56
- #include "common/string.h"
57
- #include "funcapi.h"
58
- #include "jit/jit.h"
59
- #include "libpq/auth.h"
60
- #include "libpq/libpq.h"
61
- #include "libpq/pqformat.h"
62
- #include "miscadmin.h"
63
- #include "optimizer/cost.h"
64
- #include "optimizer/geqo.h"
65
- #include "optimizer/optimizer.h"
66
- #include "optimizer/paths.h"
67
- #include "optimizer/planmain.h"
68
- #include "parser/parse_expr.h"
69
- #include "parser/parse_type.h"
70
- #include "parser/parser.h"
71
- #include "parser/scansup.h"
72
- #include "pgstat.h"
73
- #include "postmaster/autovacuum.h"
74
- #include "postmaster/bgworker_internals.h"
75
- #include "postmaster/bgwriter.h"
76
- #include "postmaster/postmaster.h"
77
- #include "postmaster/syslogger.h"
78
- #include "postmaster/walwriter.h"
79
- #include "replication/logicallauncher.h"
80
- #include "replication/reorderbuffer.h"
81
- #include "replication/slot.h"
82
- #include "replication/syncrep.h"
83
- #include "replication/walreceiver.h"
84
- #include "replication/walsender.h"
85
- #include "storage/bufmgr.h"
86
- #include "storage/dsm_impl.h"
87
- #include "storage/fd.h"
88
- #include "storage/large_object.h"
89
- #include "storage/pg_shmem.h"
90
- #include "storage/predicate.h"
91
- #include "storage/proc.h"
92
- #include "storage/standby.h"
93
- #include "tcop/tcopprot.h"
94
- #include "tsearch/ts_cache.h"
95
- #include "utils/acl.h"
96
- #include "utils/builtins.h"
97
- #include "utils/bytea.h"
98
- #include "utils/float.h"
99
- #include "utils/guc_tables.h"
100
- #include "utils/memutils.h"
101
- #include "utils/pg_locale.h"
102
- #include "utils/pg_lsn.h"
103
- #include "utils/plancache.h"
104
- #include "utils/portal.h"
105
- #include "utils/ps_status.h"
106
- #include "utils/rls.h"
107
- #include "utils/snapmgr.h"
108
- #include "utils/tzparser.h"
109
- #include "utils/varlena.h"
110
- #include "utils/xml.h"
111
-
112
- #ifndef PG_KRB_SRVTAB
113
- #define PG_KRB_SRVTAB ""
114
- #endif
115
-
116
- #define CONFIG_FILENAME "postgresql.conf"
117
- #define HBA_FILENAME "pg_hba.conf"
118
- #define IDENT_FILENAME "pg_ident.conf"
119
-
120
- #ifdef EXEC_BACKEND
121
- #define CONFIG_EXEC_PARAMS "global/config_exec_params"
122
- #define CONFIG_EXEC_PARAMS_NEW "global/config_exec_params.new"
123
- #endif
124
-
125
- /*
126
- * Precision with which REAL type guc values are to be printed for GUC
127
- * serialization.
128
- */
129
- #define REALTYPE_PRECISION 17
130
-
131
- /* XXX these should appear in other modules' header files */
132
- extern bool Log_disconnections;
133
- extern int CommitDelay;
134
- extern int CommitSiblings;
135
- extern char *default_tablespace;
136
- extern char *temp_tablespaces;
137
- extern bool ignore_checksum_failure;
138
- extern bool ignore_invalid_pages;
139
- extern bool synchronize_seqscans;
140
-
141
- #ifdef TRACE_SYNCSCAN
142
- extern bool trace_syncscan;
143
- #endif
144
- #ifdef DEBUG_BOUNDED_SORT
145
- extern bool optimize_bounded_sort;
146
- #endif
147
-
148
-
149
-
150
- /* global variables for check hook support */
151
-
152
-
153
-
154
-
155
- static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg_attribute_printf(3, 4);
156
-
157
- static void set_config_sourcefile(const char *name, char *sourcefile,
158
- int sourceline);
159
- static bool call_bool_check_hook(struct config_bool *conf, bool *newval,
160
- void **extra, GucSource source, int elevel);
161
- static bool call_int_check_hook(struct config_int *conf, int *newval,
162
- void **extra, GucSource source, int elevel);
163
- static bool call_real_check_hook(struct config_real *conf, double *newval,
164
- void **extra, GucSource source, int elevel);
165
- static bool call_string_check_hook(struct config_string *conf, char **newval,
166
- void **extra, GucSource source, int elevel);
167
- static bool call_enum_check_hook(struct config_enum *conf, int *newval,
168
- void **extra, GucSource source, int elevel);
169
-
170
- static bool check_log_destination(char **newval, void **extra, GucSource source);
171
- static void assign_log_destination(const char *newval, void *extra);
172
-
173
- static bool check_wal_consistency_checking(char **newval, void **extra,
174
- GucSource source);
175
- static void assign_wal_consistency_checking(const char *newval, void *extra);
176
-
177
- #ifdef HAVE_SYSLOG
178
-
179
- #else
180
- static int syslog_facility = 0;
181
- #endif
182
-
183
- static void assign_syslog_facility(int newval, void *extra);
184
- static void assign_syslog_ident(const char *newval, void *extra);
185
- static void assign_session_replication_role(int newval, void *extra);
186
- static bool check_temp_buffers(int *newval, void **extra, GucSource source);
187
- static bool check_bonjour(bool *newval, void **extra, GucSource source);
188
- static bool check_ssl(bool *newval, void **extra, GucSource source);
189
- static bool check_stage_log_stats(bool *newval, void **extra, GucSource source);
190
- static bool check_log_stats(bool *newval, void **extra, GucSource source);
191
- static bool check_canonical_path(char **newval, void **extra, GucSource source);
192
- static bool check_timezone_abbreviations(char **newval, void **extra, GucSource source);
193
- static void assign_timezone_abbreviations(const char *newval, void *extra);
194
- static void pg_timezone_abbrev_initialize(void);
195
- static const char *show_archive_command(void);
196
- static void assign_tcp_keepalives_idle(int newval, void *extra);
197
- static void assign_tcp_keepalives_interval(int newval, void *extra);
198
- static void assign_tcp_keepalives_count(int newval, void *extra);
199
- static void assign_tcp_user_timeout(int newval, void *extra);
200
- static const char *show_tcp_keepalives_idle(void);
201
- static const char *show_tcp_keepalives_interval(void);
202
- static const char *show_tcp_keepalives_count(void);
203
- static const char *show_tcp_user_timeout(void);
204
- static bool check_maxconnections(int *newval, void **extra, GucSource source);
205
- static bool check_max_worker_processes(int *newval, void **extra, GucSource source);
206
- static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source);
207
- static bool check_max_wal_senders(int *newval, void **extra, GucSource source);
208
- static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source);
209
- static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source);
210
- static bool check_maintenance_io_concurrency(int *newval, void **extra, GucSource source);
211
- static void assign_pgstat_temp_directory(const char *newval, void *extra);
212
- static bool check_application_name(char **newval, void **extra, GucSource source);
213
- static void assign_application_name(const char *newval, void *extra);
214
- static bool check_cluster_name(char **newval, void **extra, GucSource source);
215
- static const char *show_unix_socket_permissions(void);
216
- static const char *show_log_file_mode(void);
217
- static const char *show_data_directory_mode(void);
218
- static bool check_backtrace_functions(char **newval, void **extra, GucSource source);
219
- static void assign_backtrace_functions(const char *newval, void *extra);
220
- static bool check_recovery_target_timeline(char **newval, void **extra, GucSource source);
221
- static void assign_recovery_target_timeline(const char *newval, void *extra);
222
- static bool check_recovery_target(char **newval, void **extra, GucSource source);
223
- static void assign_recovery_target(const char *newval, void *extra);
224
- static bool check_recovery_target_xid(char **newval, void **extra, GucSource source);
225
- static void assign_recovery_target_xid(const char *newval, void *extra);
226
- static bool check_recovery_target_time(char **newval, void **extra, GucSource source);
227
- static void assign_recovery_target_time(const char *newval, void *extra);
228
- static bool check_recovery_target_name(char **newval, void **extra, GucSource source);
229
- static void assign_recovery_target_name(const char *newval, void *extra);
230
- static bool check_recovery_target_lsn(char **newval, void **extra, GucSource source);
231
- static void assign_recovery_target_lsn(const char *newval, void *extra);
232
- static bool check_primary_slot_name(char **newval, void **extra, GucSource source);
233
- static bool check_default_with_oids(bool *newval, void **extra, GucSource source);
234
-
235
- /* Private functions in guc-file.l that need to be called from guc.c */
236
- static ConfigVariable *ProcessConfigFileInternal(GucContext context,
237
- bool applySettings, int elevel);
238
-
239
-
240
- /*
241
- * Options for enum values defined in this module.
242
- *
243
- * NOTE! Option values may not contain double quotes!
244
- */
245
-
246
-
247
-
248
- StaticAssertDecl(lengthof(bytea_output_options) == (BYTEA_OUTPUT_HEX + 2),
249
- "array length mismatch");
250
-
251
- /*
252
- * We have different sets for client and server message level options because
253
- * they sort slightly different (see "log" level), and because "fatal"/"panic"
254
- * aren't sensible for client_min_messages.
255
- */
256
-
257
-
258
-
259
-
260
-
261
-
262
- StaticAssertDecl(lengthof(intervalstyle_options) == (INTSTYLE_ISO_8601 + 2),
263
- "array length mismatch");
264
-
265
-
266
-
267
- StaticAssertDecl(lengthof(log_error_verbosity_options) == (PGERROR_VERBOSE + 2),
268
- "array length mismatch");
269
-
270
-
271
-
272
- StaticAssertDecl(lengthof(log_statement_options) == (LOGSTMT_ALL + 2),
273
- "array length mismatch");
274
-
275
-
276
-
277
-
278
-
279
- StaticAssertDecl(lengthof(session_replication_role_options) == (SESSION_REPLICATION_ROLE_LOCAL + 2),
280
- "array length mismatch");
281
-
282
- #ifdef HAVE_SYSLOG
283
- #else
284
- #endif
285
-
286
-
287
-
288
- StaticAssertDecl(lengthof(track_function_options) == (TRACK_FUNC_ALL + 2),
289
- "array length mismatch");
290
-
291
-
292
-
293
- StaticAssertDecl(lengthof(xmlbinary_options) == (XMLBINARY_HEX + 2),
294
- "array length mismatch");
295
-
296
-
297
-
298
- StaticAssertDecl(lengthof(xmloption_options) == (XMLOPTION_CONTENT + 2),
299
- "array length mismatch");
300
-
301
- /*
302
- * Although only "on", "off", and "safe_encoding" are documented, we
303
- * accept all the likely variants of "on" and "off".
304
- */
305
-
306
-
307
- /*
308
- * Although only "on", "off", and "partition" are documented, we
309
- * accept all the likely variants of "on" and "off".
310
- */
311
-
312
-
313
- /*
314
- * Although only "on", "off", "remote_apply", "remote_write", and "local" are
315
- * documented, we accept all the likely variants of "on" and "off".
316
- */
317
-
318
-
319
- /*
320
- * Although only "on", "off", "try" are documented, we accept all the likely
321
- * variants of "on" and "off".
322
- */
323
-
324
-
325
-
326
-
327
-
328
-
329
- /*
330
- * password_encryption used to be a boolean, so accept all the likely
331
- * variants of "on", too. "off" used to store passwords in plaintext,
332
- * but we don't support that anymore.
333
- */
334
-
335
-
336
-
337
-
338
- StaticAssertDecl(lengthof(ssl_protocol_versions_info) == (PG_TLS1_3_VERSION + 2),
339
- "array length mismatch");
340
-
341
- #ifndef WIN32
342
- #endif
343
- #ifndef EXEC_BACKEND
344
- #endif
345
- #ifdef WIN32
346
- #endif
347
-
348
- /*
349
- * Options for enum values stored in other modules
350
- */
351
- extern const struct config_enum_entry wal_level_options[];
352
- extern const struct config_enum_entry archive_mode_options[];
353
- extern const struct config_enum_entry recovery_target_action_options[];
354
- extern const struct config_enum_entry sync_method_options[];
355
- extern const struct config_enum_entry dynamic_shared_memory_options[];
356
-
357
- /*
358
- * GUC option variables that are exported from this module
359
- */
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
- /* this is sort of all three above
370
- * together */
371
-
372
-
373
-
374
-
375
- __thread bool check_function_bodies = true;
376
-
377
-
378
- /*
379
- * This GUC exists solely for backward compatibility, check its definition for
380
- * details.
381
- */
382
-
383
-
384
-
385
-
386
- __thread int log_min_messages = WARNING;
387
-
388
- __thread int client_min_messages = NOTICE;
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
- __thread char *backtrace_functions;
399
-
400
- __thread char *backtrace_symbol_list;
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
-
420
-
421
-
422
- /*
423
- * SSL renegotiation was been removed in PostgreSQL 9.5, but we tolerate it
424
- * being set to zero (meaning never renegotiate) for backward compatibility.
425
- * This avoids breaking compatibility with clients that have never supported
426
- * renegotiation and therefore always try to zero it.
427
- */
428
-
429
-
430
- /*
431
- * This really belongs in pg_shmem.c, but is defined here so that it doesn't
432
- * need to be duplicated in all the different implementations of pg_shmem.c.
433
- */
434
-
435
-
436
- /*
437
- * These variables are all dummies that don't do anything, except in some
438
- * cases provide the value for SHOW to display. The real state is elsewhere
439
- * and is kept in sync by assign_hooks.
440
- */
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
- /* should be static, but commands/variable.c needs to get at this */
472
-
473
-
474
-
475
- /*
476
- * Displayable names for context types (enum GucContext)
477
- *
478
- * Note: these strings are deliberately not localized.
479
- */
480
-
481
-
482
- StaticAssertDecl(lengthof(GucContext_Names) == (PGC_USERSET + 1),
483
- "array length mismatch");
484
-
485
- /*
486
- * Displayable names for source types (enum GucSource)
487
- *
488
- * Note: these strings are deliberately not localized.
489
- */
490
-
491
-
492
- StaticAssertDecl(lengthof(GucSource_Names) == (PGC_S_SESSION + 1),
493
- "array length mismatch");
494
-
495
- /*
496
- * Displayable names for the groupings defined in enum config_group
497
- */
498
-
499
-
500
- StaticAssertDecl(lengthof(config_group_names) == (DEVELOPER_OPTIONS + 2),
501
- "array length mismatch");
502
-
503
- /*
504
- * Displayable names for GUC variable types (enum config_type)
505
- *
506
- * Note: these strings are deliberately not localized.
507
- */
508
-
509
-
510
- StaticAssertDecl(lengthof(config_type_names) == (PGC_ENUM + 1),
511
- "array length mismatch");
512
-
513
- /*
514
- * Unit conversion tables.
515
- *
516
- * There are two tables, one for memory units, and another for time units.
517
- * For each supported conversion from one unit to another, we have an entry
518
- * in the table.
519
- *
520
- * To keep things simple, and to avoid possible roundoff error,
521
- * conversions are never chained. There needs to be a direct conversion
522
- * between all units (of the same type).
523
- *
524
- * The conversions for each base unit must be kept in order from greatest to
525
- * smallest human-friendly unit; convert_xxx_from_base_unit() rely on that.
526
- * (The order of the base-unit groups does not matter.)
527
- */
528
- #define MAX_UNIT_LEN 3 /* length of longest recognized unit string */
529
-
530
- typedef struct
531
- {
532
- char unit[MAX_UNIT_LEN + 1]; /* unit, as a string, like "kB" or
533
- * "min" */
534
- int base_unit; /* GUC_UNIT_XXX */
535
- double multiplier; /* Factor for converting unit -> base_unit */
536
- } unit_conversion;
537
-
538
- /* Ensure that the constants in the tables don't overflow or underflow */
539
- #if BLCKSZ < 1024 || BLCKSZ > (1024*1024)
540
- #error BLCKSZ must be between 1KB and 1MB
541
- #endif
542
- #if XLOG_BLCKSZ < 1024 || XLOG_BLCKSZ > (1024*1024)
543
- #error XLOG_BLCKSZ must be between 1KB and 1MB
544
- #endif
545
-
546
-
547
-
548
-
549
-
550
-
551
-
552
-
553
-
554
- /*
555
- * Contents of GUC tables
556
- *
557
- * See src/backend/utils/misc/README for design notes.
558
- *
559
- * TO ADD AN OPTION:
560
- *
561
- * 1. Declare a global variable of type bool, int, double, or char*
562
- * and make use of it.
563
- *
564
- * 2. Decide at what times it's safe to set the option. See guc.h for
565
- * details.
566
- *
567
- * 3. Decide on a name, a default value, upper and lower bounds (if
568
- * applicable), etc.
569
- *
570
- * 4. Add a record below.
571
- *
572
- * 5. Add it to src/backend/utils/misc/postgresql.conf.sample, if
573
- * appropriate.
574
- *
575
- * 6. Don't forget to document the option (at least in config.sgml).
576
- *
577
- * 7. If it's a new GUC_LIST_QUOTE option, you must add it to
578
- * variable_is_guc_list_quote() in src/bin/pg_dump/dumputils.c.
579
- */
580
-
581
-
582
- /******** option records follow ********/
583
-
584
- #ifdef USE_ASSERT_CHECKING
585
- #else
586
- #endif
587
- #ifdef BTREE_BUILD_STATS
588
- #endif
589
- #ifdef WIN32
590
- #else
591
- #endif
592
- #ifdef LOCK_DEBUG
593
- #endif
594
- #ifdef TRACE_SORT
595
- #endif
596
- #ifdef TRACE_SYNCSCAN
597
- #endif
598
- #ifdef DEBUG_BOUNDED_SORT
599
- #endif
600
- #ifdef WAL_DEBUG
601
- #endif
602
-
603
-
604
- #ifdef LOCK_DEBUG
605
- #endif
606
- #ifdef USE_PREFETCH
607
- #else
608
- #endif
609
- #ifdef USE_PREFETCH
610
- #else
611
- #endif
612
-
613
-
614
-
615
-
616
-
617
- #ifdef HAVE_UNIX_SOCKETS
618
- #else
619
- #endif
620
- #ifdef USE_SSL
621
- #else
622
- #endif
623
- #ifdef USE_OPENSSL
624
- #else
625
- #endif
626
- #ifdef USE_SSL
627
- #else
628
- #endif
629
-
630
-
631
- #ifdef HAVE_SYSLOG
632
- #else
633
- #endif
634
-
635
- /******** end of options list ********/
636
-
637
-
638
- /*
639
- * To allow continued support of obsolete names for GUC variables, we apply
640
- * the following mappings to any unrecognized name. Note that an old name
641
- * should be mapped to a new one only if the new variable has very similar
642
- * semantics to the old.
643
- */
644
-
645
-
646
-
647
- /*
648
- * Actual lookup of variables is done through this single, sorted array.
649
- */
650
-
651
-
652
- /* Current number of variables contained in the vector */
653
-
654
-
655
- /* Vector capacity */
656
-
657
-
658
-
659
- /* true if need to do commit/abort work */
660
-
661
- /* true to enable GUC_REPORT */
662
-
663
- /* 1 when in main transaction */
664
-
665
-
666
- static int guc_var_compare(const void *a, const void *b);
667
- static int guc_name_compare(const char *namea, const char *nameb);
668
- static void InitializeGUCOptionsFromEnvironment(void);
669
- static void InitializeOneGUCOption(struct config_generic *gconf);
670
- static void push_old_value(struct config_generic *gconf, GucAction action);
671
- static void ReportGUCOption(struct config_generic *record);
672
- static void reapply_stacked_values(struct config_generic *variable,
673
- struct config_string *pHolder,
674
- GucStack *stack,
675
- const char *curvalue,
676
- GucContext curscontext, GucSource cursource);
677
- static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
678
- static void ShowAllGUCConfig(DestReceiver *dest);
679
- static char *_ShowOption(struct config_generic *record, bool use_units);
680
- static bool validate_option_array_item(const char *name, const char *value,
681
- bool skipIfNoPermissions);
682
- static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p);
683
- static void replace_auto_config_value(ConfigVariable **head_p, ConfigVariable **tail_p,
684
- const char *name, const char *value);
685
-
686
-
687
- /*
688
- * Some infrastructure for checking malloc/strdup/realloc calls
689
- */
690
-
691
-
692
-
693
-
694
-
695
-
696
-
697
- /*
698
- * Detect whether strval is referenced anywhere in a GUC string item
699
- */
700
-
701
-
702
- /*
703
- * Support for assigning to a field of a string GUC item. Free the prior
704
- * value if it's not referenced anywhere else in the item (including stacked
705
- * states).
706
- */
707
-
708
-
709
- /*
710
- * Detect whether an "extra" struct is referenced anywhere in a GUC item
711
- */
712
-
713
-
714
- /*
715
- * Support for assigning to an "extra" field of a GUC item. Free the prior
716
- * value if it's not referenced anywhere else in the item (including stacked
717
- * states).
718
- */
719
-
720
-
721
- /*
722
- * Support for copying a variable's active value into a stack entry.
723
- * The "extra" field associated with the active value is copied, too.
724
- *
725
- * NB: be sure stringval and extra fields of a new stack entry are
726
- * initialized to NULL before this is used, else we'll try to free() them.
727
- */
728
-
729
-
730
- /*
731
- * Support for discarding a no-longer-needed value in a stack entry.
732
- * The "extra" field associated with the stack entry is cleared, too.
733
- */
734
-
735
-
736
-
737
- /*
738
- * Fetch the sorted array pointer (exported for help_config.c's use ONLY)
739
- */
740
-
741
-
742
-
743
- /*
744
- * Build the sorted array. This is split out so that it could be
745
- * re-executed after startup (e.g., we could allow loadable modules to
746
- * add vars, and then we'd need to re-sort).
747
- */
748
-
749
-
750
- /*
751
- * Add a new GUC variable to the list of known variables. The
752
- * list is expanded if needed.
753
- */
754
-
755
-
756
- /*
757
- * Create and add a placeholder variable for a custom variable name.
758
- */
759
-
760
-
761
- /*
762
- * Look up option NAME. If it exists, return a pointer to its record,
763
- * else return NULL. If create_placeholders is true, we'll create a
764
- * placeholder record for a valid-looking custom variable name.
765
- */
766
-
767
-
768
-
769
- /*
770
- * comparator for qsorting and bsearching guc_variables array
771
- */
772
-
773
-
774
- /*
775
- * the bare comparison function for GUC names
776
- */
777
-
778
-
779
-
780
- /*
781
- * Initialize GUC options during program startup.
782
- *
783
- * Note that we cannot read the config file yet, since we have not yet
784
- * processed command-line switches.
785
- */
786
-
787
-
788
- /*
789
- * Assign any GUC values that can come from the server's environment.
790
- *
791
- * This is called from InitializeGUCOptions, and also from ProcessConfigFile
792
- * to deal with the possibility that a setting has been removed from
793
- * postgresql.conf and should now get a value from the environment.
794
- * (The latter is a kludge that should probably go away someday; if so,
795
- * fold this back into InitializeGUCOptions.)
796
- */
797
-
798
-
799
- /*
800
- * Initialize one GUC option variable to its compiled-in default.
801
- *
802
- * Note: the reason for calling check_hooks is not that we think the boot_val
803
- * might fail, but that the hooks might wish to compute an "extra" struct.
804
- */
805
-
806
-
807
-
808
- /*
809
- * Select the configuration files and data directory to be used, and
810
- * do the initial read of postgresql.conf.
811
- *
812
- * This is called after processing command-line switches.
813
- * userDoption is the -D switch value if any (NULL if unspecified).
814
- * progname is just for use in error messages.
815
- *
816
- * Returns true on success; on failure, prints a suitable error message
817
- * to stderr and returns false.
818
- */
819
-
820
-
821
-
822
- /*
823
- * Reset all options to their saved default values (implements RESET ALL)
824
- */
825
-
826
-
827
-
828
- /*
829
- * push_old_value
830
- * Push previous state during transactional assignment to a GUC variable.
831
- */
832
-
833
-
834
-
835
- /*
836
- * Do GUC processing at main transaction start.
837
- */
838
-
839
-
840
- /*
841
- * Enter a new nesting level for GUC values. This is called at subtransaction
842
- * start, and when entering a function that has proconfig settings, and in
843
- * some other places where we want to set GUC variables transiently.
844
- * NOTE we must not risk error here, else subtransaction start will be unhappy.
845
- */
846
-
847
-
848
- /*
849
- * Do GUC processing at transaction or subtransaction commit or abort, or
850
- * when exiting a function that has proconfig settings, or when undoing a
851
- * transient assignment to some GUC variables. (The name is thus a bit of
852
- * a misnomer; perhaps it should be ExitGUCNestLevel or some such.)
853
- * During abort, we discard all GUC settings that were applied at nesting
854
- * levels >= nestLevel. nestLevel == 1 corresponds to the main transaction.
855
- */
856
-
857
-
858
-
859
- /*
860
- * Start up automatic reporting of changes to variables marked GUC_REPORT.
861
- * This is executed at completion of backend startup.
862
- */
863
-
864
-
865
- /*
866
- * ReportGUCOption: if appropriate, transmit option value to frontend
867
- */
868
-
869
-
870
- /*
871
- * Convert a value from one of the human-friendly units ("kB", "min" etc.)
872
- * to the given base unit. 'value' and 'unit' are the input value and unit
873
- * to convert from (there can be trailing spaces in the unit string).
874
- * The converted value is stored in *base_value.
875
- * It's caller's responsibility to round off the converted value as necessary
876
- * and check for out-of-range.
877
- *
878
- * Returns true on success, false if the input unit is not recognized.
879
- */
880
-
881
-
882
- /*
883
- * Convert an integer value in some base unit to a human-friendly unit.
884
- *
885
- * The output unit is chosen so that it's the greatest unit that can represent
886
- * the value without loss. For example, if the base unit is GUC_UNIT_KB, 1024
887
- * is converted to 1 MB, but 1025 is represented as 1025 kB.
888
- */
889
-
890
-
891
- /*
892
- * Convert a floating-point value in some base unit to a human-friendly unit.
893
- *
894
- * Same as above, except we have to do the math a bit differently, and
895
- * there's a possibility that we don't find any exact divisor.
896
- */
897
-
898
-
899
- /*
900
- * Return the name of a GUC's base unit (e.g. "ms") given its flags.
901
- * Return NULL if the GUC is unitless.
902
- */
903
-
904
-
905
-
906
- /*
907
- * Try to parse value as an integer. The accepted formats are the
908
- * usual decimal, octal, or hexadecimal formats, as well as floating-point
909
- * formats (which will be rounded to integer after any units conversion).
910
- * Optionally, the value can be followed by a unit name if "flags" indicates
911
- * a unit is allowed.
912
- *
913
- * If the string parses okay, return true, else false.
914
- * If okay and result is not NULL, return the value in *result.
915
- * If not okay and hintmsg is not NULL, *hintmsg is set to a suitable
916
- * HINT message, or NULL if no hint provided.
917
- */
918
-
919
-
920
- /*
921
- * Try to parse value as a floating point number in the usual format.
922
- * Optionally, the value can be followed by a unit name if "flags" indicates
923
- * a unit is allowed.
924
- *
925
- * If the string parses okay, return true, else false.
926
- * If okay and result is not NULL, return the value in *result.
927
- * If not okay and hintmsg is not NULL, *hintmsg is set to a suitable
928
- * HINT message, or NULL if no hint provided.
929
- */
930
-
931
-
932
-
933
- /*
934
- * Lookup the name for an enum option with the selected value.
935
- * Should only ever be called with known-valid values, so throws
936
- * an elog(ERROR) if the enum option is not found.
937
- *
938
- * The returned string is a pointer to static data and not
939
- * allocated for modification.
940
- */
941
-
942
-
943
-
944
- /*
945
- * Lookup the value for an enum option with the selected name
946
- * (case-insensitive).
947
- * If the enum option is found, sets the retval value and returns
948
- * true. If it's not found, return false and retval is set to 0.
949
- */
950
-
951
-
952
-
953
- /*
954
- * Return a list of all available options for an enum, excluding
955
- * hidden ones, separated by the given separator.
956
- * If prefix is non-NULL, it is added before the first enum value.
957
- * If suffix is non-NULL, it is added to the end of the string.
958
- */
959
-
960
-
961
- /*
962
- * Parse and validate a proposed value for the specified configuration
963
- * parameter.
964
- *
965
- * This does built-in checks (such as range limits for an integer parameter)
966
- * and also calls any check hook the parameter may have.
967
- *
968
- * record: GUC variable's info record
969
- * name: variable name (should match the record of course)
970
- * value: proposed value, as a string
971
- * source: identifies source of value (check hooks may need this)
972
- * elevel: level to log any error reports at
973
- * newval: on success, converted parameter value is returned here
974
- * newextra: on success, receives any "extra" data returned by check hook
975
- * (caller must initialize *newextra to NULL)
976
- *
977
- * Returns true if OK, false if not (or throws error, if elevel >= ERROR)
978
- */
979
-
980
-
981
-
982
- /*
983
- * Sets option `name' to given value.
984
- *
985
- * The value should be a string, which will be parsed and converted to
986
- * the appropriate data type. The context and source parameters indicate
987
- * in which context this function is being called, so that it can apply the
988
- * access restrictions properly.
989
- *
990
- * If value is NULL, set the option to its default value (normally the
991
- * reset_val, but if source == PGC_S_DEFAULT we instead use the boot_val).
992
- *
993
- * action indicates whether to set the value globally in the session, locally
994
- * to the current top transaction, or just for the duration of a function call.
995
- *
996
- * If changeVal is false then don't really set the option but do all
997
- * the checks to see if it would work.
998
- *
999
- * elevel should normally be passed as zero, allowing this function to make
1000
- * its standard choice of ereport level. However some callers need to be
1001
- * able to override that choice; they should pass the ereport level to use.
1002
- *
1003
- * Return value:
1004
- * +1: the value is valid and was successfully applied.
1005
- * 0: the name or value is invalid (but see below).
1006
- * -1: the value was not applied because of context, priority, or changeVal.
1007
- *
1008
- * If there is an error (non-existing option, invalid value) then an
1009
- * ereport(ERROR) is thrown *unless* this is called for a source for which
1010
- * we don't want an ERROR (currently, those are defaults, the config file,
1011
- * and per-database or per-user settings, as well as callers who specify
1012
- * a less-than-ERROR elevel). In those cases we write a suitable error
1013
- * message via ereport() and return 0.
1014
- *
1015
- * See also SetConfigOption for an external interface.
1016
- */
1017
- #define newval (newval_union.boolval)
1018
- #undef newval
1019
- #define newval (newval_union.intval)
1020
- #undef newval
1021
- #define newval (newval_union.realval)
1022
- #undef newval
1023
- #define newval (newval_union.stringval)
1024
- #undef newval
1025
- #define newval (newval_union.enumval)
1026
- #undef newval
1027
-
1028
-
1029
- /*
1030
- * Set the fields for source file and line number the setting came from.
1031
- */
1032
-
1033
-
1034
- /*
1035
- * Set a config option to the given value.
1036
- *
1037
- * See also set_config_option; this is just the wrapper to be called from
1038
- * outside GUC. (This function should be used when possible, because its API
1039
- * is more stable than set_config_option's.)
1040
- *
1041
- * Note: there is no support here for setting source file/line, as it
1042
- * is currently not needed.
1043
- */
1044
-
1045
-
1046
-
1047
-
1048
- /*
1049
- * Fetch the current value of the option `name', as a string.
1050
- *
1051
- * If the option doesn't exist, return NULL if missing_ok is true (NOTE that
1052
- * this cannot be distinguished from a string variable with a NULL value!),
1053
- * otherwise throw an ereport and don't return.
1054
- *
1055
- * If restrict_privileged is true, we also enforce that only superusers and
1056
- * members of the pg_read_all_settings role can see GUC_SUPERUSER_ONLY
1057
- * variables. This should only be passed as true in user-driven calls.
1058
- *
1059
- * The string is *not* allocated for modification and is really only
1060
- * valid until the next call to configuration related functions.
1061
- */
1062
-
1063
-
1064
- /*
1065
- * Get the RESET value associated with the given option.
1066
- *
1067
- * Note: this is not re-entrant, due to use of static result buffer;
1068
- * not to mention that a string variable could have its reset_val changed.
1069
- * Beware of assuming the result value is good for very long.
1070
- */
1071
-
1072
-
1073
- /*
1074
- * Get the GUC flags associated with the given option.
1075
- *
1076
- * If the option doesn't exist, return 0 if missing_ok is true,
1077
- * otherwise throw an ereport and don't return.
1078
- */
1079
-
1080
-
1081
-
1082
- /*
1083
- * flatten_set_variable_args
1084
- * Given a parsenode List as emitted by the grammar for SET,
1085
- * convert to the flat string representation used by GUC.
1086
- *
1087
- * We need to be told the name of the variable the args are for, because
1088
- * the flattening rules vary (ugh).
1089
- *
1090
- * The result is NULL if args is NIL (i.e., SET ... TO DEFAULT), otherwise
1091
- * a palloc'd string.
1092
- */
1093
-
1094
-
1095
- /*
1096
- * Write updated configuration parameter values into a temporary file.
1097
- * This function traverses the list of parameters and quotes the string
1098
- * values before writing them.
1099
- */
1100
-
1101
-
1102
- /*
1103
- * Update the given list of configuration parameters, adding, replacing
1104
- * or deleting the entry for item "name" (delete if "value" == NULL).
1105
- */
1106
-
1107
-
1108
-
1109
- /*
1110
- * Execute ALTER SYSTEM statement.
1111
- *
1112
- * Read the old PG_AUTOCONF_FILENAME file, merge in the new variable value,
1113
- * and write out an updated file. If the command is ALTER SYSTEM RESET ALL,
1114
- * we can skip reading the old file and just write an empty file.
1115
- *
1116
- * An LWLock is used to serialize updates of the configuration file.
1117
- *
1118
- * In case of an error, we leave the original automatic
1119
- * configuration file (PG_AUTOCONF_FILENAME) intact.
1120
- */
1121
-
1122
-
1123
- /*
1124
- * SET command
1125
- */
1126
-
1127
-
1128
- /*
1129
- * Get the value to assign for a VariableSetStmt, or NULL if it's RESET.
1130
- * The result is palloc'd.
1131
- *
1132
- * This is exported for use by actions such as ALTER ROLE SET.
1133
- */
1134
-
1135
-
1136
- /*
1137
- * SetPGVariable - SET command exported as an easily-C-callable function.
1138
- *
1139
- * This provides access to SET TO value, as well as SET TO DEFAULT (expressed
1140
- * by passing args == NIL), but not SET FROM CURRENT functionality.
1141
- */
1142
-
1143
-
1144
- /*
1145
- * SET command wrapped as a SQL callable function.
1146
- */
1147
-
1148
-
1149
-
1150
- /*
1151
- * Common code for DefineCustomXXXVariable subroutines: allocate the
1152
- * new variable's config struct and fill in generic fields.
1153
- */
1154
-
1155
-
1156
- /*
1157
- * Common code for DefineCustomXXXVariable subroutines: insert the new
1158
- * variable into the GUC variable array, replacing any placeholder.
1159
- */
1160
-
1161
-
1162
- /*
1163
- * Recursive subroutine for define_custom_variable: reapply non-reset values
1164
- *
1165
- * We recurse so that the values are applied in the same order as originally.
1166
- * At each recursion level, apply the upper-level value (passed in) in the
1167
- * fashion implied by the stack entry.
1168
- */
1169
-
1170
-
1171
-
1172
-
1173
-
1174
-
1175
-
1176
-
1177
-
1178
-
1179
-
1180
-
1181
-
1182
-
1183
-
1184
- /*
1185
- * SHOW command
1186
- */
1187
-
1188
-
1189
-
1190
-
1191
-
1192
- /*
1193
- * SHOW command
1194
- */
1195
-
1196
-
1197
- /*
1198
- * SHOW ALL command
1199
- */
1200
-
1201
-
1202
- /*
1203
- * Return an array of modified GUC options to show in EXPLAIN.
1204
- *
1205
- * We only report options related to query planning (marked with GUC_EXPLAIN),
1206
- * with values different from their built-in defaults.
1207
- */
1208
-
1209
-
1210
- /*
1211
- * Return GUC variable value by name; optionally return canonical form of
1212
- * name. If the GUC is unset, then throw an error unless missing_ok is true,
1213
- * in which case return NULL. Return value is palloc'd (but *varname isn't).
1214
- */
1215
-
1216
-
1217
- /*
1218
- * Return GUC variable value by variable number; optionally return canonical
1219
- * form of name. Return value is palloc'd.
1220
- */
1221
-
1222
-
1223
- /*
1224
- * Return the total number of GUC variables
1225
- */
1226
-
1227
-
1228
- /*
1229
- * show_config_by_name - equiv to SHOW X command but implemented as
1230
- * a function.
1231
- */
1232
-
1233
-
1234
- /*
1235
- * show_config_by_name_missing_ok - equiv to SHOW X command but implemented as
1236
- * a function. If X does not exist, suppress the error and just return NULL
1237
- * if missing_ok is true.
1238
- */
1239
-
1240
-
1241
- /*
1242
- * show_all_settings - equiv to SHOW ALL command but implemented as
1243
- * a Table Function.
1244
- */
1245
- #define NUM_PG_SETTINGS_ATTS 17
1246
-
1247
-
1248
-
1249
- /*
1250
- * show_all_file_settings
1251
- *
1252
- * Returns a table of all parameter settings in all configuration files
1253
- * which includes the config file pathname, the line number, a sequence number
1254
- * indicating the order in which the settings were encountered, the parameter
1255
- * name and value, a bool showing if the value could be applied, and possibly
1256
- * an associated error message. (For problems such as syntax errors, the
1257
- * parameter name/value might be NULL.)
1258
- *
1259
- * Note: no filtering is done here, instead we depend on the GRANT system
1260
- * to prevent unprivileged users from accessing this function or the view
1261
- * built on top of it.
1262
- */
1263
- #define NUM_PG_FILE_SETTINGS_ATTS 7
1264
-
1265
-
1266
-
1267
-
1268
- #ifdef EXEC_BACKEND
1269
-
1270
- /*
1271
- * These routines dump out all non-default GUC options into a binary
1272
- * file that is read by all exec'ed backends. The format is:
1273
- *
1274
- * variable name, string, null terminated
1275
- * variable value, string, null terminated
1276
- * variable sourcefile, string, null terminated (empty if none)
1277
- * variable sourceline, integer
1278
- * variable source, integer
1279
- * variable scontext, integer
1280
- */
1281
- static void
1282
- write_one_nondefault_variable(FILE *fp, struct config_generic *gconf)
1283
- {
1284
- if (gconf->source == PGC_S_DEFAULT)
1285
- return;
1286
-
1287
- fprintf(fp, "%s", gconf->name);
1288
- fputc(0, fp);
1289
-
1290
- switch (gconf->vartype)
1291
- {
1292
- case PGC_BOOL:
1293
- {
1294
- struct config_bool *conf = (struct config_bool *) gconf;
1295
-
1296
- if (*conf->variable)
1297
- fprintf(fp, "true");
1298
- else
1299
- fprintf(fp, "false");
1300
- }
1301
- break;
1302
-
1303
- case PGC_INT:
1304
- {
1305
- struct config_int *conf = (struct config_int *) gconf;
1306
-
1307
- fprintf(fp, "%d", *conf->variable);
1308
- }
1309
- break;
1310
-
1311
- case PGC_REAL:
1312
- {
1313
- struct config_real *conf = (struct config_real *) gconf;
1314
-
1315
- fprintf(fp, "%.17g", *conf->variable);
1316
- }
1317
- break;
1318
-
1319
- case PGC_STRING:
1320
- {
1321
- struct config_string *conf = (struct config_string *) gconf;
1322
-
1323
- fprintf(fp, "%s", *conf->variable);
1324
- }
1325
- break;
1326
-
1327
- case PGC_ENUM:
1328
- {
1329
- struct config_enum *conf = (struct config_enum *) gconf;
1330
-
1331
- fprintf(fp, "%s",
1332
- config_enum_lookup_by_value(conf, *conf->variable));
1333
- }
1334
- break;
1335
- }
1336
-
1337
- fputc(0, fp);
1338
-
1339
- if (gconf->sourcefile)
1340
- fprintf(fp, "%s", gconf->sourcefile);
1341
- fputc(0, fp);
1342
-
1343
- fwrite(&gconf->sourceline, 1, sizeof(gconf->sourceline), fp);
1344
- fwrite(&gconf->source, 1, sizeof(gconf->source), fp);
1345
- fwrite(&gconf->scontext, 1, sizeof(gconf->scontext), fp);
1346
- }
1347
-
1348
- void
1349
- write_nondefault_variables(GucContext context)
1350
- {
1351
- int elevel;
1352
- FILE *fp;
1353
- int i;
1354
-
1355
- Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);
1356
-
1357
- elevel = (context == PGC_SIGHUP) ? LOG : ERROR;
1358
-
1359
- /*
1360
- * Open file
1361
- */
1362
- fp = AllocateFile(CONFIG_EXEC_PARAMS_NEW, "w");
1363
- if (!fp)
1364
- {
1365
- ereport(elevel,
1366
- (errcode_for_file_access(),
1367
- errmsg("could not write to file \"%s\": %m",
1368
- CONFIG_EXEC_PARAMS_NEW)));
1369
- return;
1370
- }
1371
-
1372
- for (i = 0; i < num_guc_variables; i++)
1373
- {
1374
- write_one_nondefault_variable(fp, guc_variables[i]);
1375
- }
1376
-
1377
- if (FreeFile(fp))
1378
- {
1379
- ereport(elevel,
1380
- (errcode_for_file_access(),
1381
- errmsg("could not write to file \"%s\": %m",
1382
- CONFIG_EXEC_PARAMS_NEW)));
1383
- return;
1384
- }
1385
-
1386
- /*
1387
- * Put new file in place. This could delay on Win32, but we don't hold
1388
- * any exclusive locks.
1389
- */
1390
- rename(CONFIG_EXEC_PARAMS_NEW, CONFIG_EXEC_PARAMS);
1391
- }
1392
-
1393
-
1394
- /*
1395
- * Read string, including null byte from file
1396
- *
1397
- * Return NULL on EOF and nothing read
1398
- */
1399
- static char *
1400
- read_string_with_null(FILE *fp)
1401
- {
1402
- int i = 0,
1403
- ch,
1404
- maxlen = 256;
1405
- char *str = NULL;
1406
-
1407
- do
1408
- {
1409
- if ((ch = fgetc(fp)) == EOF)
1410
- {
1411
- if (i == 0)
1412
- return NULL;
1413
- else
1414
- elog(FATAL, "invalid format of exec config params file");
1415
- }
1416
- if (i == 0)
1417
- str = guc_malloc(FATAL, maxlen);
1418
- else if (i == maxlen)
1419
- str = guc_realloc(FATAL, str, maxlen *= 2);
1420
- str[i++] = ch;
1421
- } while (ch != 0);
1422
-
1423
- return str;
1424
- }
1425
-
1426
-
1427
- /*
1428
- * This routine loads a previous postmaster dump of its non-default
1429
- * settings.
1430
- */
1431
- void
1432
- read_nondefault_variables(void)
1433
- {
1434
- FILE *fp;
1435
- char *varname,
1436
- *varvalue,
1437
- *varsourcefile;
1438
- int varsourceline;
1439
- GucSource varsource;
1440
- GucContext varscontext;
1441
-
1442
- /*
1443
- * Assert that PGC_BACKEND/PGC_SU_BACKEND case in set_config_option() will
1444
- * do the right thing.
1445
- */
1446
- Assert(IsInitProcessingMode());
1447
-
1448
- /*
1449
- * Open file
1450
- */
1451
- fp = AllocateFile(CONFIG_EXEC_PARAMS, "r");
1452
- if (!fp)
1453
- {
1454
- /* File not found is fine */
1455
- if (errno != ENOENT)
1456
- ereport(FATAL,
1457
- (errcode_for_file_access(),
1458
- errmsg("could not read from file \"%s\": %m",
1459
- CONFIG_EXEC_PARAMS)));
1460
- return;
1461
- }
1462
-
1463
- for (;;)
1464
- {
1465
- struct config_generic *record;
1466
-
1467
- if ((varname = read_string_with_null(fp)) == NULL)
1468
- break;
1469
-
1470
- if ((record = find_option(varname, true, FATAL)) == NULL)
1471
- elog(FATAL, "failed to locate variable \"%s\" in exec config params file", varname);
1472
-
1473
- if ((varvalue = read_string_with_null(fp)) == NULL)
1474
- elog(FATAL, "invalid format of exec config params file");
1475
- if ((varsourcefile = read_string_with_null(fp)) == NULL)
1476
- elog(FATAL, "invalid format of exec config params file");
1477
- if (fread(&varsourceline, 1, sizeof(varsourceline), fp) != sizeof(varsourceline))
1478
- elog(FATAL, "invalid format of exec config params file");
1479
- if (fread(&varsource, 1, sizeof(varsource), fp) != sizeof(varsource))
1480
- elog(FATAL, "invalid format of exec config params file");
1481
- if (fread(&varscontext, 1, sizeof(varscontext), fp) != sizeof(varscontext))
1482
- elog(FATAL, "invalid format of exec config params file");
1483
-
1484
- (void) set_config_option(varname, varvalue,
1485
- varscontext, varsource,
1486
- GUC_ACTION_SET, true, 0, true);
1487
- if (varsourcefile[0])
1488
- set_config_sourcefile(varname, varsourcefile, varsourceline);
1489
-
1490
- free(varname);
1491
- free(varvalue);
1492
- free(varsourcefile);
1493
- }
1494
-
1495
- FreeFile(fp);
1496
- }
1497
- #endif /* EXEC_BACKEND */
1498
-
1499
- /*
1500
- * can_skip_gucvar:
1501
- * When serializing, determine whether to skip this GUC. When restoring, the
1502
- * negation of this test determines whether to restore the compiled-in default
1503
- * value before processing serialized values.
1504
- *
1505
- * A PGC_S_DEFAULT setting on the serialize side will typically match new
1506
- * postmaster children, but that can be false when got_SIGHUP == true and the
1507
- * pending configuration change modifies this setting. Nonetheless, we omit
1508
- * PGC_S_DEFAULT settings from serialization and make up for that by restoring
1509
- * defaults before applying serialized values.
1510
- *
1511
- * PGC_POSTMASTER variables always have the same value in every child of a
1512
- * particular postmaster. Most PGC_INTERNAL variables are compile-time
1513
- * constants; a few, like server_encoding and lc_ctype, are handled specially
1514
- * outside the serialize/restore procedure. Therefore, SerializeGUCState()
1515
- * never sends these, and RestoreGUCState() never changes them.
1516
- *
1517
- * Role is a special variable in the sense that its current value can be an
1518
- * invalid value and there are multiple ways by which that can happen (like
1519
- * after setting the role, someone drops it). So we handle it outside of
1520
- * serialize/restore machinery.
1521
- */
1522
-
1523
-
1524
- /*
1525
- * estimate_variable_size:
1526
- * Compute space needed for dumping the given GUC variable.
1527
- *
1528
- * It's OK to overestimate, but not to underestimate.
1529
- */
1530
-
1531
-
1532
- /*
1533
- * EstimateGUCStateSpace:
1534
- * Returns the size needed to store the GUC state for the current process
1535
- */
1536
-
1537
-
1538
- /*
1539
- * do_serialize:
1540
- * Copies the formatted string into the destination. Moves ahead the
1541
- * destination pointer, and decrements the maxbytes by that many bytes. If
1542
- * maxbytes is not sufficient to copy the string, error out.
1543
- */
1544
-
1545
-
1546
- /* Binary copy version of do_serialize() */
1547
-
1548
-
1549
- /*
1550
- * serialize_variable:
1551
- * Dumps name, value and other information of a GUC variable into destptr.
1552
- */
1553
-
1554
-
1555
- /*
1556
- * SerializeGUCState:
1557
- * Dumps the complete GUC state onto the memory location at start_address.
1558
- */
1559
-
1560
-
1561
- /*
1562
- * read_gucstate:
1563
- * Actually it does not read anything, just returns the srcptr. But it does
1564
- * move the srcptr past the terminating zero byte, so that the caller is ready
1565
- * to read the next string.
1566
- */
1567
-
1568
-
1569
- /* Binary read version of read_gucstate(). Copies into dest */
1570
-
1571
-
1572
- /*
1573
- * Callback used to add a context message when reporting errors that occur
1574
- * while trying to restore GUCs in parallel workers.
1575
- */
1576
-
1577
-
1578
- /*
1579
- * RestoreGUCState:
1580
- * Reads the GUC state at the specified address and updates the GUCs with the
1581
- * values read from the GUC state.
1582
- */
1583
-
1584
-
1585
- /*
1586
- * A little "long argument" simulation, although not quite GNU
1587
- * compliant. Takes a string of the form "some-option=some value" and
1588
- * returns name = "some_option" and value = "some value" in malloc'ed
1589
- * storage. Note that '-' is converted to '_' in the option name. If
1590
- * there is no '=' in the input string then value will be NULL.
1591
- */
1592
-
1593
-
1594
-
1595
- /*
1596
- * Handle options fetched from pg_db_role_setting.setconfig,
1597
- * pg_proc.proconfig, etc. Caller must specify proper context/source/action.
1598
- *
1599
- * The array parameter must be an array of TEXT (it must not be NULL).
1600
- */
1601
-
1602
-
1603
-
1604
- /*
1605
- * Add an entry to an option array. The array parameter may be NULL
1606
- * to indicate the current table entry is NULL.
1607
- */
1608
-
1609
-
1610
-
1611
- /*
1612
- * Delete an entry from an option array. The array parameter may be NULL
1613
- * to indicate the current table entry is NULL. Also, if the return value
1614
- * is NULL then a null should be stored.
1615
- */
1616
-
1617
-
1618
-
1619
- /*
1620
- * Given a GUC array, delete all settings from it that our permission
1621
- * level allows: if superuser, delete them all; if regular user, only
1622
- * those that are PGC_USERSET
1623
- */
1624
-
1625
-
1626
- /*
1627
- * Validate a proposed option setting for GUCArrayAdd/Delete/Reset.
1628
- *
1629
- * name is the option name. value is the proposed value for the Add case,
1630
- * or NULL for the Delete/Reset cases. If skipIfNoPermissions is true, it's
1631
- * not an error to have no permissions to set the option.
1632
- *
1633
- * Returns true if OK, false if skipIfNoPermissions is true and user does not
1634
- * have permission to change this option (all other error cases result in an
1635
- * error being thrown).
1636
- */
1637
-
1638
-
1639
-
1640
- /*
1641
- * Called by check_hooks that want to override the normal
1642
- * ERRCODE_INVALID_PARAMETER_VALUE SQLSTATE for check hook failures.
1643
- *
1644
- * Note that GUC_check_errmsg() etc are just macros that result in a direct
1645
- * assignment to the associated variables. That is ugly, but forced by the
1646
- * limitations of C's macro mechanisms.
1647
- */
1648
-
1649
-
1650
-
1651
- /*
1652
- * Convenience functions to manage calling a variable's check_hook.
1653
- * These mostly take care of the protocol for letting check hooks supply
1654
- * portions of the error report on failure.
1655
- */
1656
-
1657
-
1658
-
1659
-
1660
-
1661
-
1662
-
1663
-
1664
-
1665
-
1666
-
1667
-
1668
- /*
1669
- * check_hook, assign_hook and show_hook subroutines
1670
- */
1671
-
1672
-
1673
-
1674
-
1675
-
1676
- #ifdef HAVE_SYSLOG
1677
- #endif
1678
- #ifdef WIN32
1679
- #endif
1680
-
1681
-
1682
-
1683
- #ifdef HAVE_SYSLOG
1684
- #endif
1685
-
1686
- #ifdef HAVE_SYSLOG
1687
- #endif
1688
-
1689
-
1690
-
1691
-
1692
-
1693
-
1694
- #ifndef USE_BONJOUR
1695
- #endif
1696
-
1697
- #ifndef USE_SSL
1698
- #endif
1699
-
1700
-
1701
-
1702
-
1703
-
1704
-
1705
-
1706
-
1707
-
1708
-
1709
-
1710
- /*
1711
- * pg_timezone_abbrev_initialize --- set default value if not done already
1712
- *
1713
- * This is called after initial loading of postgresql.conf. If no
1714
- * timezone_abbreviations setting was found therein, select default.
1715
- * If a non-default value is already installed, nothing will happen.
1716
- *
1717
- * This can also be called from ProcessConfigFile to establish the default
1718
- * value after a postgresql.conf entry for it is removed.
1719
- */
1720
-
1721
-
1722
-
1723
-
1724
-
1725
-
1726
-
1727
-
1728
-
1729
-
1730
-
1731
-
1732
-
1733
-
1734
-
1735
-
1736
-
1737
-
1738
-
1739
-
1740
-
1741
-
1742
-
1743
-
1744
-
1745
-
1746
-
1747
-
1748
-
1749
-
1750
- #ifndef USE_PREFETCH
1751
- #endif /* USE_PREFETCH */
1752
-
1753
- #ifndef USE_PREFETCH
1754
- #endif /* USE_PREFETCH */
1755
-
1756
-
1757
-
1758
-
1759
-
1760
-
1761
-
1762
-
1763
-
1764
-
1765
-
1766
-
1767
-
1768
-
1769
-
1770
- /*
1771
- * We split the input string, where commas separate function names
1772
- * and certain whitespace chars are ignored, into a \0-separated (and
1773
- * \0\0-terminated) list of function names. This formulation allows
1774
- * easy scanning when an error is thrown while avoiding the use of
1775
- * non-reentrant strtok(), as well as keeping the output data in a
1776
- * single palloc() chunk.
1777
- */
1778
-
1779
-
1780
-
1781
-
1782
-
1783
-
1784
-
1785
-
1786
- /*
1787
- * Recovery target settings: Only one of the several recovery_target* settings
1788
- * may be set. Setting a second one results in an error. The global variable
1789
- * recoveryTarget tracks which kind of recovery target was chosen. Other
1790
- * variables store the actual target value (for example a string or a xid).
1791
- * The assign functions of the parameters check whether a competing parameter
1792
- * was already set. But we want to allow setting the same parameter multiple
1793
- * times. We also want to allow unsetting a parameter and setting a different
1794
- * one, so we unset recoveryTarget when the parameter is set to an empty
1795
- * string.
1796
- */
1797
-
1798
-
1799
-
1800
-
1801
-
1802
-
1803
-
1804
-
1805
-
1806
-
1807
-
1808
- /*
1809
- * The interpretation of the recovery_target_time string can depend on the
1810
- * time zone setting, so we need to wait until after all GUC processing is
1811
- * done before we can do the final parsing of the string. This check function
1812
- * only does a parsing pass to catch syntax errors, but we store the string
1813
- * and parse it again when we need to use it.
1814
- */
1815
-
1816
-
1817
-
1818
-
1819
-
1820
-
1821
-
1822
-
1823
-
1824
-
1825
-
1826
-
1827
-
1828
-
1829
-
1830
-
1831
- #include "guc-file.c"