prestogres 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (393) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +20 -0
  4. data/LICENSE +202 -0
  5. data/NOTICE +22 -0
  6. data/README.md +217 -0
  7. data/Rakefile +13 -0
  8. data/VERSION +1 -0
  9. data/bin/prestogres +254 -0
  10. data/config/pcp.conf.sample +28 -0
  11. data/config/pgpool.conf +678 -0
  12. data/config/pool_hba.conf +84 -0
  13. data/config/pool_passwd +0 -0
  14. data/config/postgresql.conf +2 -0
  15. data/ext/.gitignore +6 -0
  16. data/ext/depend +26 -0
  17. data/ext/extconf.rb +4 -0
  18. data/ext/prestogres_config.c +12 -0
  19. data/pgpool2/.gitignore +36 -0
  20. data/pgpool2/AUTHORS +4 -0
  21. data/pgpool2/COPYING +12 -0
  22. data/pgpool2/ChangeLog +1 -0
  23. data/pgpool2/INSTALL +1 -0
  24. data/pgpool2/Makefile.am +159 -0
  25. data/pgpool2/Makefile.in +1187 -0
  26. data/pgpool2/NEWS +4960 -0
  27. data/pgpool2/README +1 -0
  28. data/pgpool2/README.euc_jp +1 -0
  29. data/pgpool2/README.online-recovery +62 -0
  30. data/pgpool2/TODO +103 -0
  31. data/pgpool2/ac_func_accept_argtypes.m4 +85 -0
  32. data/pgpool2/aclocal.m4 +1088 -0
  33. data/pgpool2/c-compiler.m4 +134 -0
  34. data/pgpool2/c-library.m4 +325 -0
  35. data/pgpool2/child.c +2097 -0
  36. data/pgpool2/config.guess +1532 -0
  37. data/pgpool2/config.h.in +332 -0
  38. data/pgpool2/config.sub +1640 -0
  39. data/pgpool2/configure +15752 -0
  40. data/pgpool2/configure.in +392 -0
  41. data/pgpool2/depcomp +522 -0
  42. data/pgpool2/doc/basebackup.sh +17 -0
  43. data/pgpool2/doc/pgpool-de.html +4220 -0
  44. data/pgpool2/doc/pgpool-en.html +5738 -0
  45. data/pgpool2/doc/pgpool-fr.html +4118 -0
  46. data/pgpool2/doc/pgpool-ja.css +198 -0
  47. data/pgpool2/doc/pgpool-ja.html +11279 -0
  48. data/pgpool2/doc/pgpool-zh_cn.html +4445 -0
  49. data/pgpool2/doc/pgpool.css +280 -0
  50. data/pgpool2/doc/pgpool_remote_start +13 -0
  51. data/pgpool2/doc/recovery.conf.sample +117 -0
  52. data/pgpool2/doc/tutorial-en.html +707 -0
  53. data/pgpool2/doc/tutorial-ja.html +422 -0
  54. data/pgpool2/doc/tutorial-memqcache-en.html +325 -0
  55. data/pgpool2/doc/tutorial-memqcache-ja.html +370 -0
  56. data/pgpool2/doc/tutorial-memqcache-zh_cn.html +322 -0
  57. data/pgpool2/doc/tutorial-watchdog-en.html +306 -0
  58. data/pgpool2/doc/tutorial-watchdog-ja.html +343 -0
  59. data/pgpool2/doc/tutorial-watchdog-zh_cn.html +301 -0
  60. data/pgpool2/doc/tutorial-zh_cn.html +537 -0
  61. data/pgpool2/doc/watchdog.png +0 -0
  62. data/pgpool2/doc/wd-en.html +236 -0
  63. data/pgpool2/doc/wd-en.jpg +0 -0
  64. data/pgpool2/doc/wd-ja.html +219 -0
  65. data/pgpool2/doc/wd-ja.jpg +0 -0
  66. data/pgpool2/doc/wd-zh_cn.html +201 -0
  67. data/pgpool2/doc/where_to_send_queries.odg +0 -0
  68. data/pgpool2/doc/where_to_send_queries.pdf +0 -0
  69. data/pgpool2/general.m4 +166 -0
  70. data/pgpool2/getopt_long.c +200 -0
  71. data/pgpool2/getopt_long.h +44 -0
  72. data/pgpool2/install-sh +251 -0
  73. data/pgpool2/ltmain.sh +8406 -0
  74. data/pgpool2/m4/libtool.m4 +7360 -0
  75. data/pgpool2/m4/ltoptions.m4 +368 -0
  76. data/pgpool2/m4/ltsugar.m4 +123 -0
  77. data/pgpool2/m4/ltversion.m4 +23 -0
  78. data/pgpool2/m4/lt~obsolete.m4 +92 -0
  79. data/pgpool2/main.c +2971 -0
  80. data/pgpool2/md5.c +444 -0
  81. data/pgpool2/md5.h +28 -0
  82. data/pgpool2/missing +360 -0
  83. data/pgpool2/mkinstalldirs +40 -0
  84. data/pgpool2/parser/Makefile.am +50 -0
  85. data/pgpool2/parser/Makefile.in +559 -0
  86. data/pgpool2/parser/copyfuncs.c +3310 -0
  87. data/pgpool2/parser/gram.c +39100 -0
  88. data/pgpool2/parser/gram.h +940 -0
  89. data/pgpool2/parser/gram.y +13408 -0
  90. data/pgpool2/parser/gramparse.h +74 -0
  91. data/pgpool2/parser/keywords.c +32 -0
  92. data/pgpool2/parser/keywords.h +39 -0
  93. data/pgpool2/parser/kwlist.h +425 -0
  94. data/pgpool2/parser/kwlookup.c +88 -0
  95. data/pgpool2/parser/list.c +1156 -0
  96. data/pgpool2/parser/makefuncs.c +518 -0
  97. data/pgpool2/parser/makefuncs.h +83 -0
  98. data/pgpool2/parser/memnodes.h +79 -0
  99. data/pgpool2/parser/nodes.c +29 -0
  100. data/pgpool2/parser/nodes.h +609 -0
  101. data/pgpool2/parser/outfuncs.c +5790 -0
  102. data/pgpool2/parser/parsenodes.h +2615 -0
  103. data/pgpool2/parser/parser.c +262 -0
  104. data/pgpool2/parser/parser.h +46 -0
  105. data/pgpool2/parser/pg_class.h +158 -0
  106. data/pgpool2/parser/pg_config_manual.h +273 -0
  107. data/pgpool2/parser/pg_list.h +352 -0
  108. data/pgpool2/parser/pg_trigger.h +147 -0
  109. data/pgpool2/parser/pg_wchar.h +492 -0
  110. data/pgpool2/parser/pool_memory.c +342 -0
  111. data/pgpool2/parser/pool_memory.h +77 -0
  112. data/pgpool2/parser/pool_parser.h +222 -0
  113. data/pgpool2/parser/pool_string.c +121 -0
  114. data/pgpool2/parser/pool_string.h +37 -0
  115. data/pgpool2/parser/primnodes.h +1280 -0
  116. data/pgpool2/parser/scan.c +4094 -0
  117. data/pgpool2/parser/scan.l +1451 -0
  118. data/pgpool2/parser/scanner.h +120 -0
  119. data/pgpool2/parser/scansup.c +221 -0
  120. data/pgpool2/parser/scansup.h +28 -0
  121. data/pgpool2/parser/snprintf.c +1102 -0
  122. data/pgpool2/parser/stringinfo.c +294 -0
  123. data/pgpool2/parser/stringinfo.h +178 -0
  124. data/pgpool2/parser/value.c +78 -0
  125. data/pgpool2/parser/value.h +62 -0
  126. data/pgpool2/parser/wchar.c +2048 -0
  127. data/pgpool2/pcp.conf.sample +28 -0
  128. data/pgpool2/pcp/Makefile.am +40 -0
  129. data/pgpool2/pcp/Makefile.in +771 -0
  130. data/pgpool2/pcp/libpcp_ext.h +250 -0
  131. data/pgpool2/pcp/md5.c +444 -0
  132. data/pgpool2/pcp/md5.h +28 -0
  133. data/pgpool2/pcp/pcp.c +1652 -0
  134. data/pgpool2/pcp/pcp.h +61 -0
  135. data/pgpool2/pcp/pcp_attach_node.c +172 -0
  136. data/pgpool2/pcp/pcp_detach_node.c +185 -0
  137. data/pgpool2/pcp/pcp_error.c +87 -0
  138. data/pgpool2/pcp/pcp_node_count.c +160 -0
  139. data/pgpool2/pcp/pcp_node_info.c +198 -0
  140. data/pgpool2/pcp/pcp_pool_status.c +166 -0
  141. data/pgpool2/pcp/pcp_proc_count.c +166 -0
  142. data/pgpool2/pcp/pcp_proc_info.c +261 -0
  143. data/pgpool2/pcp/pcp_promote_node.c +185 -0
  144. data/pgpool2/pcp/pcp_recovery_node.c +172 -0
  145. data/pgpool2/pcp/pcp_stop_pgpool.c +179 -0
  146. data/pgpool2/pcp/pcp_stream.c +385 -0
  147. data/pgpool2/pcp/pcp_stream.h +52 -0
  148. data/pgpool2/pcp/pcp_systemdb_info.c +194 -0
  149. data/pgpool2/pcp/pcp_watchdog_info.c +211 -0
  150. data/pgpool2/pcp_child.c +1493 -0
  151. data/pgpool2/pg_md5.c +305 -0
  152. data/pgpool2/pgpool.8.in +121 -0
  153. data/pgpool2/pgpool.conf +553 -0
  154. data/pgpool2/pgpool.conf.sample +666 -0
  155. data/pgpool2/pgpool.conf.sample-master-slave +665 -0
  156. data/pgpool2/pgpool.conf.sample-replication +664 -0
  157. data/pgpool2/pgpool.conf.sample-stream +664 -0
  158. data/pgpool2/pgpool.spec +264 -0
  159. data/pgpool2/pgpool_adm/TODO +7 -0
  160. data/pgpool2/pgpool_adm/pgpool_adm--1.0.sql +85 -0
  161. data/pgpool2/pgpool_adm/pgpool_adm.c +558 -0
  162. data/pgpool2/pgpool_adm/pgpool_adm.control +5 -0
  163. data/pgpool2/pgpool_adm/pgpool_adm.h +46 -0
  164. data/pgpool2/pgpool_adm/pgpool_adm.sql.in +85 -0
  165. data/pgpool2/pool.h +655 -0
  166. data/pgpool2/pool_auth.c +1390 -0
  167. data/pgpool2/pool_config.c +5007 -0
  168. data/pgpool2/pool_config.h +284 -0
  169. data/pgpool2/pool_config.l +3281 -0
  170. data/pgpool2/pool_config_md5.c +29 -0
  171. data/pgpool2/pool_connection_pool.c +812 -0
  172. data/pgpool2/pool_error.c +242 -0
  173. data/pgpool2/pool_globals.c +27 -0
  174. data/pgpool2/pool_hba.c +1723 -0
  175. data/pgpool2/pool_hba.conf.sample +67 -0
  176. data/pgpool2/pool_ip.c +567 -0
  177. data/pgpool2/pool_ip.h +65 -0
  178. data/pgpool2/pool_ipc.h +38 -0
  179. data/pgpool2/pool_lobj.c +242 -0
  180. data/pgpool2/pool_lobj.h +32 -0
  181. data/pgpool2/pool_memqcache.c +3818 -0
  182. data/pgpool2/pool_memqcache.h +268 -0
  183. data/pgpool2/pool_params.c +163 -0
  184. data/pgpool2/pool_passwd.c +249 -0
  185. data/pgpool2/pool_passwd.h +41 -0
  186. data/pgpool2/pool_path.c +193 -0
  187. data/pgpool2/pool_path.h +81 -0
  188. data/pgpool2/pool_process_context.c +247 -0
  189. data/pgpool2/pool_process_context.h +62 -0
  190. data/pgpool2/pool_process_query.c +5001 -0
  191. data/pgpool2/pool_process_reporting.c +1671 -0
  192. data/pgpool2/pool_process_reporting.h +44 -0
  193. data/pgpool2/pool_proto2.c +671 -0
  194. data/pgpool2/pool_proto_modules.c +3524 -0
  195. data/pgpool2/pool_proto_modules.h +185 -0
  196. data/pgpool2/pool_query_cache.c +1020 -0
  197. data/pgpool2/pool_query_context.c +1871 -0
  198. data/pgpool2/pool_query_context.h +105 -0
  199. data/pgpool2/pool_relcache.c +284 -0
  200. data/pgpool2/pool_relcache.h +78 -0
  201. data/pgpool2/pool_rewrite_outfuncs.c +9060 -0
  202. data/pgpool2/pool_rewrite_query.c +715 -0
  203. data/pgpool2/pool_rewrite_query.h +192 -0
  204. data/pgpool2/pool_select_walker.c +1150 -0
  205. data/pgpool2/pool_select_walker.h +68 -0
  206. data/pgpool2/pool_sema.c +161 -0
  207. data/pgpool2/pool_session_context.c +952 -0
  208. data/pgpool2/pool_session_context.h +203 -0
  209. data/pgpool2/pool_shmem.c +185 -0
  210. data/pgpool2/pool_signal.c +158 -0
  211. data/pgpool2/pool_signal.h +61 -0
  212. data/pgpool2/pool_ssl.c +339 -0
  213. data/pgpool2/pool_stream.c +962 -0
  214. data/pgpool2/pool_stream.h +61 -0
  215. data/pgpool2/pool_system.c +659 -0
  216. data/pgpool2/pool_timestamp.c +1215 -0
  217. data/pgpool2/pool_timestamp.h +38 -0
  218. data/pgpool2/pool_type.h +171 -0
  219. data/pgpool2/pool_worker_child.c +384 -0
  220. data/pgpool2/ps_status.c +404 -0
  221. data/pgpool2/recovery.c +435 -0
  222. data/pgpool2/redhat/pgpool.conf.sample.patch +52 -0
  223. data/pgpool2/redhat/pgpool.init +201 -0
  224. data/pgpool2/redhat/pgpool.sysconfig +7 -0
  225. data/pgpool2/redhat/rpm_installer/basebackup-replication.sh +53 -0
  226. data/pgpool2/redhat/rpm_installer/basebackup-stream.sh +55 -0
  227. data/pgpool2/redhat/rpm_installer/config_for_script +17 -0
  228. data/pgpool2/redhat/rpm_installer/failover.sh +64 -0
  229. data/pgpool2/redhat/rpm_installer/getsources.sh +141 -0
  230. data/pgpool2/redhat/rpm_installer/install.sh +1363 -0
  231. data/pgpool2/redhat/rpm_installer/pgpool_recovery_pitr +47 -0
  232. data/pgpool2/redhat/rpm_installer/pgpool_remote_start +15 -0
  233. data/pgpool2/redhat/rpm_installer/recovery.conf +4 -0
  234. data/pgpool2/redhat/rpm_installer/uninstall.sh +57 -0
  235. data/pgpool2/sample/dist_def_pgbench.sql +73 -0
  236. data/pgpool2/sample/pgpool.pam +3 -0
  237. data/pgpool2/sample/pgpool_recovery +20 -0
  238. data/pgpool2/sample/pgpool_recovery_pitr +19 -0
  239. data/pgpool2/sample/pgpool_remote_start +13 -0
  240. data/pgpool2/sample/replicate_def_pgbench.sql +18 -0
  241. data/pgpool2/sql/insert_lock.sql +15 -0
  242. data/pgpool2/sql/pgpool-recovery/pgpool-recovery.c +280 -0
  243. data/pgpool2/sql/pgpool-recovery/pgpool-recovery.sql.in +19 -0
  244. data/pgpool2/sql/pgpool-recovery/pgpool_recovery--1.0.sql +24 -0
  245. data/pgpool2/sql/pgpool-recovery/pgpool_recovery.control +5 -0
  246. data/pgpool2/sql/pgpool-recovery/uninstall_pgpool-recovery.sql +3 -0
  247. data/pgpool2/sql/pgpool-regclass/pgpool-regclass.c +206 -0
  248. data/pgpool2/sql/pgpool-regclass/pgpool-regclass.sql.in +4 -0
  249. data/pgpool2/sql/pgpool-regclass/pgpool_regclass--1.0.sql +7 -0
  250. data/pgpool2/sql/pgpool-regclass/pgpool_regclass.control +5 -0
  251. data/pgpool2/sql/pgpool-regclass/uninstall_pgpool-regclass.sql +1 -0
  252. data/pgpool2/sql/system_db.sql +38 -0
  253. data/pgpool2/strlcpy.c +85 -0
  254. data/pgpool2/test/C/test_extended.c +98 -0
  255. data/pgpool2/test/jdbc/.cvsignore +2 -0
  256. data/pgpool2/test/jdbc/AutoCommitTest.java +45 -0
  257. data/pgpool2/test/jdbc/BatchTest.java +55 -0
  258. data/pgpool2/test/jdbc/ColumnTest.java +60 -0
  259. data/pgpool2/test/jdbc/CreateTempTableTest.java +48 -0
  260. data/pgpool2/test/jdbc/InsertTest.java +34 -0
  261. data/pgpool2/test/jdbc/LockTest.java +36 -0
  262. data/pgpool2/test/jdbc/PgpoolTest.java +75 -0
  263. data/pgpool2/test/jdbc/README.euc_jp +73 -0
  264. data/pgpool2/test/jdbc/RunTest.java +83 -0
  265. data/pgpool2/test/jdbc/SelectTest.java +37 -0
  266. data/pgpool2/test/jdbc/UpdateTest.java +32 -0
  267. data/pgpool2/test/jdbc/expected/CreateTempTable +1 -0
  268. data/pgpool2/test/jdbc/expected/autocommit +10 -0
  269. data/pgpool2/test/jdbc/expected/batch +1 -0
  270. data/pgpool2/test/jdbc/expected/column +100 -0
  271. data/pgpool2/test/jdbc/expected/insert +1 -0
  272. data/pgpool2/test/jdbc/expected/lock +100 -0
  273. data/pgpool2/test/jdbc/expected/select +2 -0
  274. data/pgpool2/test/jdbc/expected/update +1 -0
  275. data/pgpool2/test/jdbc/pgpool.properties +7 -0
  276. data/pgpool2/test/jdbc/prepare.sql +54 -0
  277. data/pgpool2/test/jdbc/run.sh +6 -0
  278. data/pgpool2/test/parser/.cvsignore +6 -0
  279. data/pgpool2/test/parser/README +32 -0
  280. data/pgpool2/test/parser/expected/copy.out +17 -0
  281. data/pgpool2/test/parser/expected/create.out +64 -0
  282. data/pgpool2/test/parser/expected/cursor.out +37 -0
  283. data/pgpool2/test/parser/expected/delete.out +10 -0
  284. data/pgpool2/test/parser/expected/drop.out +12 -0
  285. data/pgpool2/test/parser/expected/insert.out +13 -0
  286. data/pgpool2/test/parser/expected/misc.out +28 -0
  287. data/pgpool2/test/parser/expected/prepare.out +4 -0
  288. data/pgpool2/test/parser/expected/privileges.out +31 -0
  289. data/pgpool2/test/parser/expected/scanner.out +30 -0
  290. data/pgpool2/test/parser/expected/select.out +89 -0
  291. data/pgpool2/test/parser/expected/transaction.out +38 -0
  292. data/pgpool2/test/parser/expected/update.out +11 -0
  293. data/pgpool2/test/parser/expected/v84.out +37 -0
  294. data/pgpool2/test/parser/expected/v90.out +25 -0
  295. data/pgpool2/test/parser/expected/var.out +22 -0
  296. data/pgpool2/test/parser/input/alter.sql +2 -0
  297. data/pgpool2/test/parser/input/copy.sql +17 -0
  298. data/pgpool2/test/parser/input/create.sql +64 -0
  299. data/pgpool2/test/parser/input/cursor.sql +37 -0
  300. data/pgpool2/test/parser/input/delete.sql +10 -0
  301. data/pgpool2/test/parser/input/drop.sql +12 -0
  302. data/pgpool2/test/parser/input/insert.sql +13 -0
  303. data/pgpool2/test/parser/input/misc.sql +28 -0
  304. data/pgpool2/test/parser/input/prepare.sql +4 -0
  305. data/pgpool2/test/parser/input/privileges.sql +31 -0
  306. data/pgpool2/test/parser/input/scanner.sql +34 -0
  307. data/pgpool2/test/parser/input/select.sql +89 -0
  308. data/pgpool2/test/parser/input/transaction.sql +38 -0
  309. data/pgpool2/test/parser/input/update.sql +11 -0
  310. data/pgpool2/test/parser/input/v84.sql +37 -0
  311. data/pgpool2/test/parser/input/v90.sql +38 -0
  312. data/pgpool2/test/parser/input/var.sql +22 -0
  313. data/pgpool2/test/parser/main.c +96 -0
  314. data/pgpool2/test/parser/parse_schedule +16 -0
  315. data/pgpool2/test/parser/pool.h +13 -0
  316. data/pgpool2/test/parser/run-test +62 -0
  317. data/pgpool2/test/pdo-test/README.euc_jp +58 -0
  318. data/pgpool2/test/pdo-test/SQLlist/test1.sql +3 -0
  319. data/pgpool2/test/pdo-test/SQLlist/test2.sql +3 -0
  320. data/pgpool2/test/pdo-test/collections.inc +11 -0
  321. data/pgpool2/test/pdo-test/def.inc +7 -0
  322. data/pgpool2/test/pdo-test/log.txt +0 -0
  323. data/pgpool2/test/pdo-test/mod/database.inc +36 -0
  324. data/pgpool2/test/pdo-test/mod/def.inc +0 -0
  325. data/pgpool2/test/pdo-test/mod/errorhandler.inc +27 -0
  326. data/pgpool2/test/pdo-test/pdotest.php +11 -0
  327. data/pgpool2/test/pdo-test/regsql.inc +56 -0
  328. data/pgpool2/test/pgpool_setup +898 -0
  329. data/pgpool2/test/regression/README +39 -0
  330. data/pgpool2/test/regression/clean.sh +21 -0
  331. data/pgpool2/test/regression/libs.sh +16 -0
  332. data/pgpool2/test/regression/regress.sh +166 -0
  333. data/pgpool2/test/regression/tests/001.load_balance/test.sh +128 -0
  334. data/pgpool2/test/regression/tests/002.native_replication/PgTester.java +47 -0
  335. data/pgpool2/test/regression/tests/002.native_replication/create.sql +6 -0
  336. data/pgpool2/test/regression/tests/002.native_replication/test.sh +71 -0
  337. data/pgpool2/test/regression/tests/003.failover/expected.r +6 -0
  338. data/pgpool2/test/regression/tests/003.failover/expected.s +6 -0
  339. data/pgpool2/test/regression/tests/003.failover/test.sh +45 -0
  340. data/pgpool2/test/regression/tests/004.watchdog/master.conf +12 -0
  341. data/pgpool2/test/regression/tests/004.watchdog/standby.conf +19 -0
  342. data/pgpool2/test/regression/tests/004.watchdog/test.sh +52 -0
  343. data/pgpool2/test/regression/tests/050.bug58/test.sh +50 -0
  344. data/pgpool2/test/regression/tests/051.bug60/bug.sql +12 -0
  345. data/pgpool2/test/regression/tests/051.bug60/database-clean.sql +6 -0
  346. data/pgpool2/test/regression/tests/051.bug60/database-setup.sql +28 -0
  347. data/pgpool2/test/regression/tests/051.bug60/test.sh +79 -0
  348. data/pgpool2/test/regression/tests/052.do_query/test.sh +44 -0
  349. data/pgpool2/test/regression/tests/053.insert_lock_hangs/test.sh +81 -0
  350. data/pgpool2/test/regression/tests/054.postgres_fdw/test.sh +67 -0
  351. data/pgpool2/test/regression/tests/055.backend_all_down/test.sh +52 -0
  352. data/pgpool2/test/regression/tests/056.bug63/jdbctest2.java +66 -0
  353. data/pgpool2/test/regression/tests/056.bug63/test.sh +47 -0
  354. data/pgpool2/test/regression/tests/057.bug61/test.sh +40 -0
  355. data/pgpool2/test/regression/tests/058.bug68/jdbctest3.java +45 -0
  356. data/pgpool2/test/regression/tests/058.bug68/test.sh +47 -0
  357. data/pgpool2/test/timestamp/expected/insert.out +16 -0
  358. data/pgpool2/test/timestamp/expected/misc.out +3 -0
  359. data/pgpool2/test/timestamp/expected/update.out +6 -0
  360. data/pgpool2/test/timestamp/input/insert.sql +16 -0
  361. data/pgpool2/test/timestamp/input/misc.sql +3 -0
  362. data/pgpool2/test/timestamp/input/update.sql +6 -0
  363. data/pgpool2/test/timestamp/main.c +129 -0
  364. data/pgpool2/test/timestamp/parse_schedule +3 -0
  365. data/pgpool2/test/timestamp/run-test +69 -0
  366. data/pgpool2/version.h +1 -0
  367. data/pgpool2/watchdog/Makefile.am +17 -0
  368. data/pgpool2/watchdog/Makefile.in +505 -0
  369. data/pgpool2/watchdog/test/stab.c +266 -0
  370. data/pgpool2/watchdog/test/test.c +85 -0
  371. data/pgpool2/watchdog/test/wd_child_t.c +87 -0
  372. data/pgpool2/watchdog/test/wd_lifecheck_t.c +87 -0
  373. data/pgpool2/watchdog/test/wd_packet_t.c +87 -0
  374. data/pgpool2/watchdog/test/wd_ping_t.c +20 -0
  375. data/pgpool2/watchdog/watchdog.c +408 -0
  376. data/pgpool2/watchdog/watchdog.h +209 -0
  377. data/pgpool2/watchdog/wd_child.c +444 -0
  378. data/pgpool2/watchdog/wd_ext.h +123 -0
  379. data/pgpool2/watchdog/wd_heartbeat.c +577 -0
  380. data/pgpool2/watchdog/wd_if.c +216 -0
  381. data/pgpool2/watchdog/wd_init.c +126 -0
  382. data/pgpool2/watchdog/wd_interlock.c +347 -0
  383. data/pgpool2/watchdog/wd_lifecheck.c +512 -0
  384. data/pgpool2/watchdog/wd_list.c +429 -0
  385. data/pgpool2/watchdog/wd_packet.c +1159 -0
  386. data/pgpool2/watchdog/wd_ping.c +330 -0
  387. data/pgpool2/ylwrap +223 -0
  388. data/pgsql/presto_client.py +346 -0
  389. data/pgsql/prestogres.py +156 -0
  390. data/pgsql/setup_functions.sql +21 -0
  391. data/pgsql/setup_language.sql +3 -0
  392. data/prestogres.gemspec +23 -0
  393. metadata +496 -0
@@ -0,0 +1,83 @@
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * makefuncs.h
4
+ * prototypes for the creator functions (for primitive nodes)
5
+ *
6
+ *
7
+ * Portions Copyright (c) 2003-2013, PgPool Global Development Group
8
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
9
+ * Portions Copyright (c) 1994, Regents of the University of California
10
+ *
11
+ * src/include/nodes/makefuncs.h
12
+ *
13
+ *-------------------------------------------------------------------------
14
+ */
15
+ #ifndef MAKEFUNC_H
16
+ #define MAKEFUNC_H
17
+
18
+ #include "parsenodes.h"
19
+
20
+
21
+ extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name,
22
+ Node *lexpr, Node *rexpr, int location);
23
+
24
+ extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, char *name,
25
+ Node *lexpr, Node *rexpr, int location);
26
+
27
+ extern Var *makeVar(Index varno,
28
+ AttrNumber varattno,
29
+ Oid vartype,
30
+ int32 vartypmod,
31
+ Oid varcollid,
32
+ Index varlevelsup);
33
+
34
+ extern Var *makeVarFromTargetEntry(Index varno,
35
+ TargetEntry *tle);
36
+
37
+ extern Var *makeWholeRowVar(RangeTblEntry *rte,
38
+ Index varno,
39
+ Index varlevelsup,
40
+ bool allowScalar);
41
+
42
+ extern TargetEntry *makeTargetEntry(Expr *expr,
43
+ AttrNumber resno,
44
+ char *resname,
45
+ bool resjunk);
46
+
47
+ extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle);
48
+
49
+ extern FromExpr *makeFromExpr(List *fromlist, Node *quals);
50
+
51
+ extern Const *makeConst(Oid consttype,
52
+ int32 consttypmod,
53
+ Oid constcollid,
54
+ int constlen,
55
+ Datum constvalue,
56
+ bool constisnull,
57
+ bool constbyval);
58
+
59
+ extern Const *makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid);
60
+
61
+ extern Node *makeBoolConst(bool value, bool isnull);
62
+
63
+ extern Expr *makeBoolExpr(BoolExprType boolop, List *args, int location);
64
+
65
+ extern Alias *makeAlias(const char *aliasname, List *colnames);
66
+
67
+ extern RelabelType *makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod,
68
+ Oid rcollid, CoercionForm rformat);
69
+
70
+ extern RangeVar *makeRangeVar(char *schemaname, char *relname, int location);
71
+
72
+ extern TypeName *makeTypeName(char *typnam);
73
+ extern TypeName *makeTypeNameFromNameList(List *names);
74
+ extern TypeName *makeTypeNameFromOid(Oid typeid, int32 typmod);
75
+
76
+ extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype, List *args,
77
+ Oid funccollid, Oid inputcollid, CoercionForm fformat);
78
+
79
+ extern DefElem *makeDefElem(char *name, Node *arg);
80
+ extern DefElem *makeDefElemExtended(char *namespace, char *name, Node *arg,
81
+ DefElemAction defaction);
82
+
83
+ #endif /* MAKEFUNC_H */
@@ -0,0 +1,79 @@
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * memnodes.h
4
+ * POSTGRES memory context node definitions.
5
+ *
6
+ *
7
+ * Portions Copyright (c) 2003-2013, PgPool Global Development Group
8
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
9
+ * Portions Copyright (c) 1994, Regents of the University of California
10
+ *
11
+ * src/include/nodes/memnodes.h
12
+ *
13
+ *-------------------------------------------------------------------------
14
+ */
15
+ #ifndef MEMNODES_H
16
+ #define MEMNODES_H
17
+
18
+ #include "nodes.h"
19
+
20
+ /*
21
+ * MemoryContext
22
+ * A logical context in which memory allocations occur.
23
+ *
24
+ * MemoryContext itself is an abstract type that can have multiple
25
+ * implementations, though for now we have only AllocSetContext.
26
+ * The function pointers in MemoryContextMethods define one specific
27
+ * implementation of MemoryContext --- they are a virtual function table
28
+ * in C++ terms.
29
+ *
30
+ * Node types that are actual implementations of memory contexts must
31
+ * begin with the same fields as MemoryContext.
32
+ *
33
+ * Note: for largely historical reasons, typedef MemoryContext is a pointer
34
+ * to the context struct rather than the struct type itself.
35
+ */
36
+
37
+ typedef struct MemoryContextMethods
38
+ {
39
+ void *(*alloc) (MemoryContext context, Size size);
40
+ /* call this free_p in case someone #define's free() */
41
+ void (*free_p) (MemoryContext context, void *pointer);
42
+ void *(*realloc) (MemoryContext context, void *pointer, Size size);
43
+ void (*init) (MemoryContext context);
44
+ void (*reset) (MemoryContext context);
45
+ void (*delete) (MemoryContext context);
46
+ Size (*get_chunk_space) (MemoryContext context, void *pointer);
47
+ bool (*is_empty) (MemoryContext context);
48
+ void (*stats) (MemoryContext context);
49
+ #ifdef MEMORY_CONTEXT_CHECKING
50
+ void (*check) (MemoryContext context);
51
+ #endif
52
+ } MemoryContextMethods;
53
+
54
+
55
+ typedef struct MemoryContextData
56
+ {
57
+ NodeTag type; /* identifies exact kind of context */
58
+ MemoryContextMethods *methods; /* virtual function table */
59
+ MemoryContext parent; /* NULL if no parent (toplevel context) */
60
+ MemoryContext firstchild; /* head of linked list of children */
61
+ MemoryContext nextchild; /* next child of same parent */
62
+ char *name; /* context name (just for debugging) */
63
+ bool isReset; /* T = no space alloced since last reset */
64
+ } MemoryContextData;
65
+
66
+ /* utils/palloc.h contains typedef struct MemoryContextData *MemoryContext */
67
+
68
+
69
+ /*
70
+ * MemoryContextIsValid
71
+ * True iff memory context is valid.
72
+ *
73
+ * Add new context types to the set accepted by this macro.
74
+ */
75
+ #define MemoryContextIsValid(context) \
76
+ ((context) != NULL && \
77
+ (IsA((context), AllocSetContext)))
78
+
79
+ #endif /* MEMNODES_H */
@@ -0,0 +1,29 @@
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * nodes.c
4
+ * support code for nodes (now that we have removed the home-brew
5
+ * inheritance system, our support code for nodes is much simpler)
6
+ *
7
+ * Portions Copyright (c) 2003-2013, PgPool Global Development Group
8
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
9
+ * Portions Copyright (c) 1994, Regents of the University of California
10
+ *
11
+ *
12
+ * IDENTIFICATION
13
+ * src/backend/nodes/nodes.c
14
+ *
15
+ * HISTORY
16
+ * Andrew Yu Oct 20, 1994 file creation
17
+ *
18
+ *-------------------------------------------------------------------------
19
+ */
20
+ /*#include "postgres.h"*/
21
+
22
+ #include "../pool_type.h"
23
+ #include "nodes.h"
24
+
25
+ /*
26
+ * Support for newNode() macro
27
+ */
28
+
29
+ Node *newNodeMacroHolder;
@@ -0,0 +1,609 @@
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * nodes.h
4
+ * Definitions for tagged nodes.
5
+ *
6
+ *
7
+ * Portions Copyright (c) 2003-2013, PgPool Global Development Group
8
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
9
+ * Portions Copyright (c) 1994, Regents of the University of California
10
+ *
11
+ * src/include/nodes/parsenodes.h
12
+ *
13
+ *-------------------------------------------------------------------------
14
+ */
15
+ #ifndef NODES_H
16
+ #define NODES_H
17
+
18
+ /*
19
+ * The first field of every node is NodeTag. Each node created (with makeNode)
20
+ * will have one of the following tags as the value of its first field.
21
+ *
22
+ * Note that the numbers of the node tags are not contiguous. We left holes
23
+ * here so that we can add more tags without changing the existing enum's.
24
+ * (Since node tag numbers never exist outside backend memory, there's no
25
+ * real harm in renumbering, it just costs a full rebuild ...)
26
+ */
27
+ typedef enum NodeTag
28
+ {
29
+ T_Invalid = 0,
30
+
31
+ /*
32
+ * TAGS FOR EXECUTOR NODES (execnodes.h)
33
+ */
34
+ T_IndexInfo = 10,
35
+ T_ExprContext,
36
+ T_ProjectionInfo,
37
+ T_JunkFilter,
38
+ T_ResultRelInfo,
39
+ T_EState,
40
+ T_TupleTableSlot,
41
+
42
+ /*
43
+ * TAGS FOR PLAN NODES (plannodes.h)
44
+ */
45
+ T_Plan = 100,
46
+ T_Result,
47
+ T_ModifyTable,
48
+ T_Append,
49
+ T_MergeAppend,
50
+ T_RecursiveUnion,
51
+ T_BitmapAnd,
52
+ T_BitmapOr,
53
+ T_Scan,
54
+ T_SeqScan,
55
+ T_IndexScan,
56
+ T_IndexOnlyScan,
57
+ T_BitmapIndexScan,
58
+ T_BitmapHeapScan,
59
+ T_TidScan,
60
+ T_SubqueryScan,
61
+ T_FunctionScan,
62
+ T_ValuesScan,
63
+ T_CteScan,
64
+ T_WorkTableScan,
65
+ T_ForeignScan,
66
+ T_Join,
67
+ T_NestLoop,
68
+ T_MergeJoin,
69
+ T_HashJoin,
70
+ T_Material,
71
+ T_Sort,
72
+ T_Group,
73
+ T_Agg,
74
+ T_WindowAgg,
75
+ T_Unique,
76
+ T_Hash,
77
+ T_SetOp,
78
+ T_LockRows,
79
+ T_Limit,
80
+ /* these aren't subclasses of Plan: */
81
+ T_NestLoopParam,
82
+ T_PlanRowMark,
83
+ T_PlanInvalItem,
84
+
85
+ /*
86
+ * TAGS FOR PLAN STATE NODES (execnodes.h)
87
+ *
88
+ * These should correspond one-to-one with Plan node types.
89
+ */
90
+ T_PlanState = 200,
91
+ T_ResultState,
92
+ T_ModifyTableState,
93
+ T_AppendState,
94
+ T_MergeAppendState,
95
+ T_RecursiveUnionState,
96
+ T_BitmapAndState,
97
+ T_BitmapOrState,
98
+ T_ScanState,
99
+ T_SeqScanState,
100
+ T_IndexScanState,
101
+ T_IndexOnlyScanState,
102
+ T_BitmapIndexScanState,
103
+ T_BitmapHeapScanState,
104
+ T_TidScanState,
105
+ T_SubqueryScanState,
106
+ T_FunctionScanState,
107
+ T_ValuesScanState,
108
+ T_CteScanState,
109
+ T_WorkTableScanState,
110
+ T_ForeignScanState,
111
+ T_JoinState,
112
+ T_NestLoopState,
113
+ T_MergeJoinState,
114
+ T_HashJoinState,
115
+ T_MaterialState,
116
+ T_SortState,
117
+ T_GroupState,
118
+ T_AggState,
119
+ T_WindowAggState,
120
+ T_UniqueState,
121
+ T_HashState,
122
+ T_SetOpState,
123
+ T_LockRowsState,
124
+ T_LimitState,
125
+
126
+ /*
127
+ * TAGS FOR PRIMITIVE NODES (primnodes.h)
128
+ */
129
+ T_Alias = 300,
130
+ T_RangeVar,
131
+ T_Expr,
132
+ T_Var,
133
+ T_Const,
134
+ T_Param,
135
+ T_Aggref,
136
+ T_WindowFunc,
137
+ T_ArrayRef,
138
+ T_FuncExpr,
139
+ T_NamedArgExpr,
140
+ T_OpExpr,
141
+ T_DistinctExpr,
142
+ T_NullIfExpr,
143
+ T_ScalarArrayOpExpr,
144
+ T_BoolExpr,
145
+ T_SubLink,
146
+ T_SubPlan,
147
+ T_AlternativeSubPlan,
148
+ T_FieldSelect,
149
+ T_FieldStore,
150
+ T_RelabelType,
151
+ T_CoerceViaIO,
152
+ T_ArrayCoerceExpr,
153
+ T_ConvertRowtypeExpr,
154
+ T_CollateExpr,
155
+ T_CaseExpr,
156
+ T_CaseWhen,
157
+ T_CaseTestExpr,
158
+ T_ArrayExpr,
159
+ T_RowExpr,
160
+ T_RowCompareExpr,
161
+ T_CoalesceExpr,
162
+ T_MinMaxExpr,
163
+ T_XmlExpr,
164
+ T_NullTest,
165
+ T_BooleanTest,
166
+ T_CoerceToDomain,
167
+ T_CoerceToDomainValue,
168
+ T_SetToDefault,
169
+ T_CurrentOfExpr,
170
+ T_TargetEntry,
171
+ T_RangeTblRef,
172
+ T_JoinExpr,
173
+ T_FromExpr,
174
+ T_IntoClause,
175
+
176
+ /*
177
+ * TAGS FOR EXPRESSION STATE NODES (execnodes.h)
178
+ *
179
+ * These correspond (not always one-for-one) to primitive nodes derived
180
+ * from Expr.
181
+ */
182
+ T_ExprState = 400,
183
+ T_GenericExprState,
184
+ T_AggrefExprState,
185
+ T_WindowFuncExprState,
186
+ T_ArrayRefExprState,
187
+ T_FuncExprState,
188
+ T_ScalarArrayOpExprState,
189
+ T_BoolExprState,
190
+ T_SubPlanState,
191
+ T_AlternativeSubPlanState,
192
+ T_FieldSelectState,
193
+ T_FieldStoreState,
194
+ T_CoerceViaIOState,
195
+ T_ArrayCoerceExprState,
196
+ T_ConvertRowtypeExprState,
197
+ T_CaseExprState,
198
+ T_CaseWhenState,
199
+ T_ArrayExprState,
200
+ T_RowExprState,
201
+ T_RowCompareExprState,
202
+ T_CoalesceExprState,
203
+ T_MinMaxExprState,
204
+ T_XmlExprState,
205
+ T_NullTestState,
206
+ T_CoerceToDomainState,
207
+ T_DomainConstraintState,
208
+ T_WholeRowVarExprState, /* will be in a more natural position in 9.3 */
209
+
210
+ /*
211
+ * TAGS FOR PLANNER NODES (relation.h)
212
+ */
213
+ T_PlannerInfo = 500,
214
+ T_PlannerGlobal,
215
+ T_RelOptInfo,
216
+ T_IndexOptInfo,
217
+ T_ParamPathInfo,
218
+ T_Path,
219
+ T_IndexPath,
220
+ T_BitmapHeapPath,
221
+ T_BitmapAndPath,
222
+ T_BitmapOrPath,
223
+ T_NestPath,
224
+ T_MergePath,
225
+ T_HashPath,
226
+ T_TidPath,
227
+ T_ForeignPath,
228
+ T_AppendPath,
229
+ T_MergeAppendPath,
230
+ T_ResultPath,
231
+ T_MaterialPath,
232
+ T_UniquePath,
233
+ T_EquivalenceClass,
234
+ T_EquivalenceMember,
235
+ T_PathKey,
236
+ T_RestrictInfo,
237
+ T_PlaceHolderVar,
238
+ T_SpecialJoinInfo,
239
+ T_AppendRelInfo,
240
+ T_PlaceHolderInfo,
241
+ T_MinMaxAggInfo,
242
+ T_PlannerParamItem,
243
+
244
+ /*
245
+ * TAGS FOR MEMORY NODES (memnodes.h)
246
+ */
247
+ T_MemoryContext = 600,
248
+ T_AllocSetContext,
249
+
250
+ /*
251
+ * TAGS FOR VALUE NODES (value.h)
252
+ */
253
+ T_Value = 650,
254
+ T_Integer,
255
+ T_Float,
256
+ T_String,
257
+ T_BitString,
258
+ T_Null,
259
+
260
+ /*
261
+ * TAGS FOR LIST NODES (pg_list.h)
262
+ */
263
+ T_List,
264
+ T_IntList,
265
+ T_OidList,
266
+
267
+ /*
268
+ * TAGS FOR STATEMENT NODES (mostly in parsenodes.h)
269
+ */
270
+ T_Query = 700,
271
+ T_PlannedStmt,
272
+ T_InsertStmt,
273
+ T_DeleteStmt,
274
+ T_UpdateStmt,
275
+ T_SelectStmt,
276
+ T_AlterTableStmt,
277
+ T_AlterTableCmd,
278
+ T_AlterDomainStmt,
279
+ T_SetOperationStmt,
280
+ T_GrantStmt,
281
+ T_GrantRoleStmt,
282
+ T_AlterDefaultPrivilegesStmt,
283
+ T_ClosePortalStmt,
284
+ T_ClusterStmt,
285
+ T_CopyStmt,
286
+ T_CreateStmt,
287
+ T_DefineStmt,
288
+ T_DropStmt,
289
+ T_TruncateStmt,
290
+ T_CommentStmt,
291
+ T_FetchStmt,
292
+ T_IndexStmt,
293
+ T_CreateFunctionStmt,
294
+ T_AlterFunctionStmt,
295
+ T_DoStmt,
296
+ T_RenameStmt,
297
+ T_RuleStmt,
298
+ T_NotifyStmt,
299
+ T_ListenStmt,
300
+ T_UnlistenStmt,
301
+ T_TransactionStmt,
302
+ T_ViewStmt,
303
+ T_LoadStmt,
304
+ T_CreateDomainStmt,
305
+ T_CreatedbStmt,
306
+ T_DropdbStmt,
307
+ T_VacuumStmt,
308
+ T_ExplainStmt,
309
+ T_CreateTableAsStmt,
310
+ T_CreateSeqStmt,
311
+ T_AlterSeqStmt,
312
+ T_VariableSetStmt,
313
+ T_VariableShowStmt,
314
+ T_DiscardStmt,
315
+ T_CreateTrigStmt,
316
+ T_CreatePLangStmt,
317
+ T_CreateRoleStmt,
318
+ T_AlterRoleStmt,
319
+ T_DropRoleStmt,
320
+ T_LockStmt,
321
+ T_ConstraintsSetStmt,
322
+ T_ReindexStmt,
323
+ T_CheckPointStmt,
324
+ T_CreateSchemaStmt,
325
+ T_AlterDatabaseStmt,
326
+ T_AlterDatabaseSetStmt,
327
+ T_AlterRoleSetStmt,
328
+ T_CreateConversionStmt,
329
+ T_CreateCastStmt,
330
+ T_CreateOpClassStmt,
331
+ T_CreateOpFamilyStmt,
332
+ T_AlterOpFamilyStmt,
333
+ T_PrepareStmt,
334
+ T_ExecuteStmt,
335
+ T_DeallocateStmt,
336
+ T_DeclareCursorStmt,
337
+ T_CreateTableSpaceStmt,
338
+ T_DropTableSpaceStmt,
339
+ T_AlterObjectSchemaStmt,
340
+ T_AlterOwnerStmt,
341
+ T_DropOwnedStmt,
342
+ T_ReassignOwnedStmt,
343
+ T_CompositeTypeStmt,
344
+ T_CreateEnumStmt,
345
+ T_CreateRangeStmt,
346
+ T_AlterEnumStmt,
347
+ T_AlterTSDictionaryStmt,
348
+ T_AlterTSConfigurationStmt,
349
+ T_CreateFdwStmt,
350
+ T_AlterFdwStmt,
351
+ T_CreateForeignServerStmt,
352
+ T_AlterForeignServerStmt,
353
+ T_CreateUserMappingStmt,
354
+ T_AlterUserMappingStmt,
355
+ T_DropUserMappingStmt,
356
+ T_AlterTableSpaceOptionsStmt,
357
+ T_SecLabelStmt,
358
+ T_CreateForeignTableStmt,
359
+ T_CreateExtensionStmt,
360
+ T_AlterExtensionStmt,
361
+ T_AlterExtensionContentsStmt,
362
+
363
+ /*
364
+ * TAGS FOR PARSE TREE NODES (parsenodes.h)
365
+ */
366
+ T_A_Expr = 900,
367
+ T_ColumnRef,
368
+ T_ParamRef,
369
+ T_A_Const,
370
+ T_FuncCall,
371
+ T_A_Star,
372
+ T_A_Indices,
373
+ T_A_Indirection,
374
+ T_A_ArrayExpr,
375
+ T_ResTarget,
376
+ T_TypeCast,
377
+ T_CollateClause,
378
+ T_SortBy,
379
+ T_WindowDef,
380
+ T_RangeSubselect,
381
+ T_RangeFunction,
382
+ T_TypeName,
383
+ T_ColumnDef,
384
+ T_IndexElem,
385
+ T_Constraint,
386
+ T_DefElem,
387
+ T_RangeTblEntry,
388
+ T_SortGroupClause,
389
+ T_WindowClause,
390
+ T_PrivGrantee,
391
+ T_FuncWithArgs,
392
+ T_AccessPriv,
393
+ T_CreateOpClassItem,
394
+ T_TableLikeClause,
395
+ T_FunctionParameter,
396
+ T_LockingClause,
397
+ T_RowMarkClause,
398
+ T_XmlSerialize,
399
+ T_WithClause,
400
+ T_CommonTableExpr,
401
+
402
+ /*
403
+ * TAGS FOR REPLICATION GRAMMAR PARSE NODES (replnodes.h)
404
+ */
405
+ T_IdentifySystemCmd,
406
+ T_BaseBackupCmd,
407
+ T_StartReplicationCmd,
408
+
409
+ /*
410
+ * TAGS FOR RANDOM OTHER STUFF
411
+ *
412
+ * These are objects that aren't part of parse/plan/execute node tree
413
+ * structures, but we give them NodeTags anyway for identification
414
+ * purposes (usually because they are involved in APIs where we want to
415
+ * pass multiple object types through the same pointer).
416
+ */
417
+ T_TriggerData = 950, /* in commands/trigger.h */
418
+ T_ReturnSetInfo, /* in nodes/execnodes.h */
419
+ T_WindowObjectData, /* private in nodeWindowAgg.c */
420
+ T_TIDBitmap, /* in nodes/tidbitmap.h */
421
+ T_InlineCodeBlock, /* in nodes/parsenodes.h */
422
+ T_FdwRoutine /* in foreign/fdwapi.h */
423
+ } NodeTag;
424
+
425
+ /*
426
+ * The first field of a node of any type is guaranteed to be the NodeTag.
427
+ * Hence the type of any node can be gotten by casting it to Node. Declaring
428
+ * a variable to be of Node * (instead of void *) can also facilitate
429
+ * debugging.
430
+ */
431
+ typedef struct Node
432
+ {
433
+ NodeTag type;
434
+ } Node;
435
+
436
+ #define nodeTag(nodeptr) (((const Node*)(nodeptr))->type)
437
+
438
+ /*
439
+ * newNode -
440
+ * create a new node of the specified size and tag the node with the
441
+ * specified tag.
442
+ *
443
+ * !WARNING!: Avoid using newNode directly. You should be using the
444
+ * macro makeNode. eg. to create a Query node, use makeNode(Query)
445
+ *
446
+ * Note: the size argument should always be a compile-time constant, so the
447
+ * apparent risk of multiple evaluation doesn't matter in practice.
448
+ */
449
+ #ifdef __GNUC__
450
+
451
+ /* With GCC, we can use a compound statement within an expression */
452
+ /* XXX AssertMacro was removed */
453
+ #define newNode(size, tag) \
454
+ ({ Node *_result; \
455
+ _result = (Node *) palloc0fast(size); \
456
+ _result->type = (tag); \
457
+ _result; \
458
+ })
459
+
460
+ #else
461
+
462
+ /*
463
+ * There is no way to dereference the palloc'ed pointer to assign the
464
+ * tag, and also return the pointer itself, so we need a holder variable.
465
+ * Fortunately, this macro isn't recursive so we just define
466
+ * a global variable for this purpose.
467
+ */
468
+ extern Node *newNodeMacroHolder;
469
+
470
+ #define newNode(size, tag) \
471
+ ( \
472
+ AssertMacro((size) >= sizeof(Node)), /* need the tag, at least */ \
473
+ newNodeMacroHolder = (Node *) palloc0fast(size), \
474
+ newNodeMacroHolder->type = (tag), \
475
+ newNodeMacroHolder \
476
+ )
477
+ #endif /* __GNUC__ */
478
+
479
+
480
+ #define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_))
481
+ #define NodeSetTag(nodeptr,t) (((Node*)(nodeptr))->type = (t))
482
+
483
+ #define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_)
484
+
485
+ /* ----------------------------------------------------------------
486
+ * extern declarations follow
487
+ * ----------------------------------------------------------------
488
+ */
489
+
490
+ /*
491
+ * nodes/{outfuncs.c,print.c}
492
+ */
493
+ extern char *nodeToString(void *obj);
494
+
495
+ /*
496
+ * nodes/{readfuncs.c,read.c}
497
+ */
498
+ extern void *stringToNode(char *str);
499
+
500
+ /*
501
+ * nodes/copyfuncs.c
502
+ */
503
+ extern void *copyObject(const void *obj);
504
+
505
+ /*
506
+ * nodes/equalfuncs.c
507
+ */
508
+ extern bool equal(const void *a, const void *b);
509
+
510
+
511
+ /*
512
+ * Typedefs for identifying qualifier selectivities and plan costs as such.
513
+ * These are just plain "double"s, but declaring a variable as Selectivity
514
+ * or Cost makes the intent more obvious.
515
+ *
516
+ * These could have gone into plannodes.h or some such, but many files
517
+ * depend on them...
518
+ */
519
+ typedef double Selectivity; /* fraction of tuples a qualifier will pass */
520
+ typedef double Cost; /* execution cost (in page-access units) */
521
+
522
+
523
+ /*
524
+ * CmdType -
525
+ * enums for type of operation represented by a Query or PlannedStmt
526
+ *
527
+ * This is needed in both parsenodes.h and plannodes.h, so put it here...
528
+ */
529
+ typedef enum CmdType
530
+ {
531
+ CMD_UNKNOWN,
532
+ CMD_SELECT, /* select stmt */
533
+ CMD_UPDATE, /* update stmt */
534
+ CMD_INSERT, /* insert stmt */
535
+ CMD_DELETE,
536
+ CMD_UTILITY, /* cmds like create, destroy, copy, vacuum,
537
+ * etc. */
538
+ CMD_NOTHING /* dummy command for instead nothing rules
539
+ * with qual */
540
+ } CmdType;
541
+
542
+
543
+ /*
544
+ * JoinType -
545
+ * enums for types of relation joins
546
+ *
547
+ * JoinType determines the exact semantics of joining two relations using
548
+ * a matching qualification. For example, it tells what to do with a tuple
549
+ * that has no match in the other relation.
550
+ *
551
+ * This is needed in both parsenodes.h and plannodes.h, so put it here...
552
+ */
553
+ typedef enum JoinType
554
+ {
555
+ /*
556
+ * The canonical kinds of joins according to the SQL JOIN syntax. Only
557
+ * these codes can appear in parser output (e.g., JoinExpr nodes).
558
+ */
559
+ JOIN_INNER, /* matching tuple pairs only */
560
+ JOIN_LEFT, /* pairs + unmatched LHS tuples */
561
+ JOIN_FULL, /* pairs + unmatched LHS + unmatched RHS */
562
+ JOIN_RIGHT, /* pairs + unmatched RHS tuples */
563
+
564
+ /*
565
+ * Semijoins and anti-semijoins (as defined in relational theory) do not
566
+ * appear in the SQL JOIN syntax, but there are standard idioms for
567
+ * representing them (e.g., using EXISTS). The planner recognizes these
568
+ * cases and converts them to joins. So the planner and executor must
569
+ * support these codes. NOTE: in JOIN_SEMI output, it is unspecified
570
+ * which matching RHS row is joined to. In JOIN_ANTI output, the row is
571
+ * guaranteed to be null-extended.
572
+ */
573
+ JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */
574
+ JOIN_ANTI, /* 1 copy of each LHS row that has no match */
575
+
576
+ /*
577
+ * These codes are used internally in the planner, but are not supported
578
+ * by the executor (nor, indeed, by most of the planner).
579
+ */
580
+ JOIN_UNIQUE_OUTER, /* LHS path must be made unique */
581
+ JOIN_UNIQUE_INNER /* RHS path must be made unique */
582
+
583
+ /*
584
+ * We might need additional join types someday.
585
+ */
586
+ } JoinType;
587
+
588
+ /*
589
+ * OUTER joins are those for which pushed-down quals must behave differently
590
+ * from the join's own quals. This is in fact everything except INNER and
591
+ * SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols
592
+ * since those are temporary proxies for what will eventually be an INNER
593
+ * join.
594
+ *
595
+ * Note: semijoins are a hybrid case, but we choose to treat them as not
596
+ * being outer joins. This is okay principally because the SQL syntax makes
597
+ * it impossible to have a pushed-down qual that refers to the inner relation
598
+ * of a semijoin; so there is no strong need to distinguish join quals from
599
+ * pushed-down quals. This is convenient because for almost all purposes,
600
+ * quals attached to a semijoin can be treated the same as innerjoin quals.
601
+ */
602
+ #define IS_OUTER_JOIN(jointype) \
603
+ (((1 << (jointype)) & \
604
+ ((1 << JOIN_LEFT) | \
605
+ (1 << JOIN_FULL) | \
606
+ (1 << JOIN_RIGHT) | \
607
+ (1 << JOIN_ANTI))) != 0)
608
+
609
+ #endif /* NODES_H */