prestogres 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +20 -0
- data/LICENSE +202 -0
- data/NOTICE +22 -0
- data/README.md +217 -0
- data/Rakefile +13 -0
- data/VERSION +1 -0
- data/bin/prestogres +254 -0
- data/config/pcp.conf.sample +28 -0
- data/config/pgpool.conf +678 -0
- data/config/pool_hba.conf +84 -0
- data/config/pool_passwd +0 -0
- data/config/postgresql.conf +2 -0
- data/ext/.gitignore +6 -0
- data/ext/depend +26 -0
- data/ext/extconf.rb +4 -0
- data/ext/prestogres_config.c +12 -0
- data/pgpool2/.gitignore +36 -0
- data/pgpool2/AUTHORS +4 -0
- data/pgpool2/COPYING +12 -0
- data/pgpool2/ChangeLog +1 -0
- data/pgpool2/INSTALL +1 -0
- data/pgpool2/Makefile.am +159 -0
- data/pgpool2/Makefile.in +1187 -0
- data/pgpool2/NEWS +4960 -0
- data/pgpool2/README +1 -0
- data/pgpool2/README.euc_jp +1 -0
- data/pgpool2/README.online-recovery +62 -0
- data/pgpool2/TODO +103 -0
- data/pgpool2/ac_func_accept_argtypes.m4 +85 -0
- data/pgpool2/aclocal.m4 +1088 -0
- data/pgpool2/c-compiler.m4 +134 -0
- data/pgpool2/c-library.m4 +325 -0
- data/pgpool2/child.c +2097 -0
- data/pgpool2/config.guess +1532 -0
- data/pgpool2/config.h.in +332 -0
- data/pgpool2/config.sub +1640 -0
- data/pgpool2/configure +15752 -0
- data/pgpool2/configure.in +392 -0
- data/pgpool2/depcomp +522 -0
- data/pgpool2/doc/basebackup.sh +17 -0
- data/pgpool2/doc/pgpool-de.html +4220 -0
- data/pgpool2/doc/pgpool-en.html +5738 -0
- data/pgpool2/doc/pgpool-fr.html +4118 -0
- data/pgpool2/doc/pgpool-ja.css +198 -0
- data/pgpool2/doc/pgpool-ja.html +11279 -0
- data/pgpool2/doc/pgpool-zh_cn.html +4445 -0
- data/pgpool2/doc/pgpool.css +280 -0
- data/pgpool2/doc/pgpool_remote_start +13 -0
- data/pgpool2/doc/recovery.conf.sample +117 -0
- data/pgpool2/doc/tutorial-en.html +707 -0
- data/pgpool2/doc/tutorial-ja.html +422 -0
- data/pgpool2/doc/tutorial-memqcache-en.html +325 -0
- data/pgpool2/doc/tutorial-memqcache-ja.html +370 -0
- data/pgpool2/doc/tutorial-memqcache-zh_cn.html +322 -0
- data/pgpool2/doc/tutorial-watchdog-en.html +306 -0
- data/pgpool2/doc/tutorial-watchdog-ja.html +343 -0
- data/pgpool2/doc/tutorial-watchdog-zh_cn.html +301 -0
- data/pgpool2/doc/tutorial-zh_cn.html +537 -0
- data/pgpool2/doc/watchdog.png +0 -0
- data/pgpool2/doc/wd-en.html +236 -0
- data/pgpool2/doc/wd-en.jpg +0 -0
- data/pgpool2/doc/wd-ja.html +219 -0
- data/pgpool2/doc/wd-ja.jpg +0 -0
- data/pgpool2/doc/wd-zh_cn.html +201 -0
- data/pgpool2/doc/where_to_send_queries.odg +0 -0
- data/pgpool2/doc/where_to_send_queries.pdf +0 -0
- data/pgpool2/general.m4 +166 -0
- data/pgpool2/getopt_long.c +200 -0
- data/pgpool2/getopt_long.h +44 -0
- data/pgpool2/install-sh +251 -0
- data/pgpool2/ltmain.sh +8406 -0
- data/pgpool2/m4/libtool.m4 +7360 -0
- data/pgpool2/m4/ltoptions.m4 +368 -0
- data/pgpool2/m4/ltsugar.m4 +123 -0
- data/pgpool2/m4/ltversion.m4 +23 -0
- data/pgpool2/m4/lt~obsolete.m4 +92 -0
- data/pgpool2/main.c +2971 -0
- data/pgpool2/md5.c +444 -0
- data/pgpool2/md5.h +28 -0
- data/pgpool2/missing +360 -0
- data/pgpool2/mkinstalldirs +40 -0
- data/pgpool2/parser/Makefile.am +50 -0
- data/pgpool2/parser/Makefile.in +559 -0
- data/pgpool2/parser/copyfuncs.c +3310 -0
- data/pgpool2/parser/gram.c +39100 -0
- data/pgpool2/parser/gram.h +940 -0
- data/pgpool2/parser/gram.y +13408 -0
- data/pgpool2/parser/gramparse.h +74 -0
- data/pgpool2/parser/keywords.c +32 -0
- data/pgpool2/parser/keywords.h +39 -0
- data/pgpool2/parser/kwlist.h +425 -0
- data/pgpool2/parser/kwlookup.c +88 -0
- data/pgpool2/parser/list.c +1156 -0
- data/pgpool2/parser/makefuncs.c +518 -0
- data/pgpool2/parser/makefuncs.h +83 -0
- data/pgpool2/parser/memnodes.h +79 -0
- data/pgpool2/parser/nodes.c +29 -0
- data/pgpool2/parser/nodes.h +609 -0
- data/pgpool2/parser/outfuncs.c +5790 -0
- data/pgpool2/parser/parsenodes.h +2615 -0
- data/pgpool2/parser/parser.c +262 -0
- data/pgpool2/parser/parser.h +46 -0
- data/pgpool2/parser/pg_class.h +158 -0
- data/pgpool2/parser/pg_config_manual.h +273 -0
- data/pgpool2/parser/pg_list.h +352 -0
- data/pgpool2/parser/pg_trigger.h +147 -0
- data/pgpool2/parser/pg_wchar.h +492 -0
- data/pgpool2/parser/pool_memory.c +342 -0
- data/pgpool2/parser/pool_memory.h +77 -0
- data/pgpool2/parser/pool_parser.h +222 -0
- data/pgpool2/parser/pool_string.c +121 -0
- data/pgpool2/parser/pool_string.h +37 -0
- data/pgpool2/parser/primnodes.h +1280 -0
- data/pgpool2/parser/scan.c +4094 -0
- data/pgpool2/parser/scan.l +1451 -0
- data/pgpool2/parser/scanner.h +120 -0
- data/pgpool2/parser/scansup.c +221 -0
- data/pgpool2/parser/scansup.h +28 -0
- data/pgpool2/parser/snprintf.c +1102 -0
- data/pgpool2/parser/stringinfo.c +294 -0
- data/pgpool2/parser/stringinfo.h +178 -0
- data/pgpool2/parser/value.c +78 -0
- data/pgpool2/parser/value.h +62 -0
- data/pgpool2/parser/wchar.c +2048 -0
- data/pgpool2/pcp.conf.sample +28 -0
- data/pgpool2/pcp/Makefile.am +40 -0
- data/pgpool2/pcp/Makefile.in +771 -0
- data/pgpool2/pcp/libpcp_ext.h +250 -0
- data/pgpool2/pcp/md5.c +444 -0
- data/pgpool2/pcp/md5.h +28 -0
- data/pgpool2/pcp/pcp.c +1652 -0
- data/pgpool2/pcp/pcp.h +61 -0
- data/pgpool2/pcp/pcp_attach_node.c +172 -0
- data/pgpool2/pcp/pcp_detach_node.c +185 -0
- data/pgpool2/pcp/pcp_error.c +87 -0
- data/pgpool2/pcp/pcp_node_count.c +160 -0
- data/pgpool2/pcp/pcp_node_info.c +198 -0
- data/pgpool2/pcp/pcp_pool_status.c +166 -0
- data/pgpool2/pcp/pcp_proc_count.c +166 -0
- data/pgpool2/pcp/pcp_proc_info.c +261 -0
- data/pgpool2/pcp/pcp_promote_node.c +185 -0
- data/pgpool2/pcp/pcp_recovery_node.c +172 -0
- data/pgpool2/pcp/pcp_stop_pgpool.c +179 -0
- data/pgpool2/pcp/pcp_stream.c +385 -0
- data/pgpool2/pcp/pcp_stream.h +52 -0
- data/pgpool2/pcp/pcp_systemdb_info.c +194 -0
- data/pgpool2/pcp/pcp_watchdog_info.c +211 -0
- data/pgpool2/pcp_child.c +1493 -0
- data/pgpool2/pg_md5.c +305 -0
- data/pgpool2/pgpool.8.in +121 -0
- data/pgpool2/pgpool.conf +553 -0
- data/pgpool2/pgpool.conf.sample +666 -0
- data/pgpool2/pgpool.conf.sample-master-slave +665 -0
- data/pgpool2/pgpool.conf.sample-replication +664 -0
- data/pgpool2/pgpool.conf.sample-stream +664 -0
- data/pgpool2/pgpool.spec +264 -0
- data/pgpool2/pgpool_adm/TODO +7 -0
- data/pgpool2/pgpool_adm/pgpool_adm--1.0.sql +85 -0
- data/pgpool2/pgpool_adm/pgpool_adm.c +558 -0
- data/pgpool2/pgpool_adm/pgpool_adm.control +5 -0
- data/pgpool2/pgpool_adm/pgpool_adm.h +46 -0
- data/pgpool2/pgpool_adm/pgpool_adm.sql.in +85 -0
- data/pgpool2/pool.h +655 -0
- data/pgpool2/pool_auth.c +1390 -0
- data/pgpool2/pool_config.c +5007 -0
- data/pgpool2/pool_config.h +284 -0
- data/pgpool2/pool_config.l +3281 -0
- data/pgpool2/pool_config_md5.c +29 -0
- data/pgpool2/pool_connection_pool.c +812 -0
- data/pgpool2/pool_error.c +242 -0
- data/pgpool2/pool_globals.c +27 -0
- data/pgpool2/pool_hba.c +1723 -0
- data/pgpool2/pool_hba.conf.sample +67 -0
- data/pgpool2/pool_ip.c +567 -0
- data/pgpool2/pool_ip.h +65 -0
- data/pgpool2/pool_ipc.h +38 -0
- data/pgpool2/pool_lobj.c +242 -0
- data/pgpool2/pool_lobj.h +32 -0
- data/pgpool2/pool_memqcache.c +3818 -0
- data/pgpool2/pool_memqcache.h +268 -0
- data/pgpool2/pool_params.c +163 -0
- data/pgpool2/pool_passwd.c +249 -0
- data/pgpool2/pool_passwd.h +41 -0
- data/pgpool2/pool_path.c +193 -0
- data/pgpool2/pool_path.h +81 -0
- data/pgpool2/pool_process_context.c +247 -0
- data/pgpool2/pool_process_context.h +62 -0
- data/pgpool2/pool_process_query.c +5001 -0
- data/pgpool2/pool_process_reporting.c +1671 -0
- data/pgpool2/pool_process_reporting.h +44 -0
- data/pgpool2/pool_proto2.c +671 -0
- data/pgpool2/pool_proto_modules.c +3524 -0
- data/pgpool2/pool_proto_modules.h +185 -0
- data/pgpool2/pool_query_cache.c +1020 -0
- data/pgpool2/pool_query_context.c +1871 -0
- data/pgpool2/pool_query_context.h +105 -0
- data/pgpool2/pool_relcache.c +284 -0
- data/pgpool2/pool_relcache.h +78 -0
- data/pgpool2/pool_rewrite_outfuncs.c +9060 -0
- data/pgpool2/pool_rewrite_query.c +715 -0
- data/pgpool2/pool_rewrite_query.h +192 -0
- data/pgpool2/pool_select_walker.c +1150 -0
- data/pgpool2/pool_select_walker.h +68 -0
- data/pgpool2/pool_sema.c +161 -0
- data/pgpool2/pool_session_context.c +952 -0
- data/pgpool2/pool_session_context.h +203 -0
- data/pgpool2/pool_shmem.c +185 -0
- data/pgpool2/pool_signal.c +158 -0
- data/pgpool2/pool_signal.h +61 -0
- data/pgpool2/pool_ssl.c +339 -0
- data/pgpool2/pool_stream.c +962 -0
- data/pgpool2/pool_stream.h +61 -0
- data/pgpool2/pool_system.c +659 -0
- data/pgpool2/pool_timestamp.c +1215 -0
- data/pgpool2/pool_timestamp.h +38 -0
- data/pgpool2/pool_type.h +171 -0
- data/pgpool2/pool_worker_child.c +384 -0
- data/pgpool2/ps_status.c +404 -0
- data/pgpool2/recovery.c +435 -0
- data/pgpool2/redhat/pgpool.conf.sample.patch +52 -0
- data/pgpool2/redhat/pgpool.init +201 -0
- data/pgpool2/redhat/pgpool.sysconfig +7 -0
- data/pgpool2/redhat/rpm_installer/basebackup-replication.sh +53 -0
- data/pgpool2/redhat/rpm_installer/basebackup-stream.sh +55 -0
- data/pgpool2/redhat/rpm_installer/config_for_script +17 -0
- data/pgpool2/redhat/rpm_installer/failover.sh +64 -0
- data/pgpool2/redhat/rpm_installer/getsources.sh +141 -0
- data/pgpool2/redhat/rpm_installer/install.sh +1363 -0
- data/pgpool2/redhat/rpm_installer/pgpool_recovery_pitr +47 -0
- data/pgpool2/redhat/rpm_installer/pgpool_remote_start +15 -0
- data/pgpool2/redhat/rpm_installer/recovery.conf +4 -0
- data/pgpool2/redhat/rpm_installer/uninstall.sh +57 -0
- data/pgpool2/sample/dist_def_pgbench.sql +73 -0
- data/pgpool2/sample/pgpool.pam +3 -0
- data/pgpool2/sample/pgpool_recovery +20 -0
- data/pgpool2/sample/pgpool_recovery_pitr +19 -0
- data/pgpool2/sample/pgpool_remote_start +13 -0
- data/pgpool2/sample/replicate_def_pgbench.sql +18 -0
- data/pgpool2/sql/insert_lock.sql +15 -0
- data/pgpool2/sql/pgpool-recovery/pgpool-recovery.c +280 -0
- data/pgpool2/sql/pgpool-recovery/pgpool-recovery.sql.in +19 -0
- data/pgpool2/sql/pgpool-recovery/pgpool_recovery--1.0.sql +24 -0
- data/pgpool2/sql/pgpool-recovery/pgpool_recovery.control +5 -0
- data/pgpool2/sql/pgpool-recovery/uninstall_pgpool-recovery.sql +3 -0
- data/pgpool2/sql/pgpool-regclass/pgpool-regclass.c +206 -0
- data/pgpool2/sql/pgpool-regclass/pgpool-regclass.sql.in +4 -0
- data/pgpool2/sql/pgpool-regclass/pgpool_regclass--1.0.sql +7 -0
- data/pgpool2/sql/pgpool-regclass/pgpool_regclass.control +5 -0
- data/pgpool2/sql/pgpool-regclass/uninstall_pgpool-regclass.sql +1 -0
- data/pgpool2/sql/system_db.sql +38 -0
- data/pgpool2/strlcpy.c +85 -0
- data/pgpool2/test/C/test_extended.c +98 -0
- data/pgpool2/test/jdbc/.cvsignore +2 -0
- data/pgpool2/test/jdbc/AutoCommitTest.java +45 -0
- data/pgpool2/test/jdbc/BatchTest.java +55 -0
- data/pgpool2/test/jdbc/ColumnTest.java +60 -0
- data/pgpool2/test/jdbc/CreateTempTableTest.java +48 -0
- data/pgpool2/test/jdbc/InsertTest.java +34 -0
- data/pgpool2/test/jdbc/LockTest.java +36 -0
- data/pgpool2/test/jdbc/PgpoolTest.java +75 -0
- data/pgpool2/test/jdbc/README.euc_jp +73 -0
- data/pgpool2/test/jdbc/RunTest.java +83 -0
- data/pgpool2/test/jdbc/SelectTest.java +37 -0
- data/pgpool2/test/jdbc/UpdateTest.java +32 -0
- data/pgpool2/test/jdbc/expected/CreateTempTable +1 -0
- data/pgpool2/test/jdbc/expected/autocommit +10 -0
- data/pgpool2/test/jdbc/expected/batch +1 -0
- data/pgpool2/test/jdbc/expected/column +100 -0
- data/pgpool2/test/jdbc/expected/insert +1 -0
- data/pgpool2/test/jdbc/expected/lock +100 -0
- data/pgpool2/test/jdbc/expected/select +2 -0
- data/pgpool2/test/jdbc/expected/update +1 -0
- data/pgpool2/test/jdbc/pgpool.properties +7 -0
- data/pgpool2/test/jdbc/prepare.sql +54 -0
- data/pgpool2/test/jdbc/run.sh +6 -0
- data/pgpool2/test/parser/.cvsignore +6 -0
- data/pgpool2/test/parser/README +32 -0
- data/pgpool2/test/parser/expected/copy.out +17 -0
- data/pgpool2/test/parser/expected/create.out +64 -0
- data/pgpool2/test/parser/expected/cursor.out +37 -0
- data/pgpool2/test/parser/expected/delete.out +10 -0
- data/pgpool2/test/parser/expected/drop.out +12 -0
- data/pgpool2/test/parser/expected/insert.out +13 -0
- data/pgpool2/test/parser/expected/misc.out +28 -0
- data/pgpool2/test/parser/expected/prepare.out +4 -0
- data/pgpool2/test/parser/expected/privileges.out +31 -0
- data/pgpool2/test/parser/expected/scanner.out +30 -0
- data/pgpool2/test/parser/expected/select.out +89 -0
- data/pgpool2/test/parser/expected/transaction.out +38 -0
- data/pgpool2/test/parser/expected/update.out +11 -0
- data/pgpool2/test/parser/expected/v84.out +37 -0
- data/pgpool2/test/parser/expected/v90.out +25 -0
- data/pgpool2/test/parser/expected/var.out +22 -0
- data/pgpool2/test/parser/input/alter.sql +2 -0
- data/pgpool2/test/parser/input/copy.sql +17 -0
- data/pgpool2/test/parser/input/create.sql +64 -0
- data/pgpool2/test/parser/input/cursor.sql +37 -0
- data/pgpool2/test/parser/input/delete.sql +10 -0
- data/pgpool2/test/parser/input/drop.sql +12 -0
- data/pgpool2/test/parser/input/insert.sql +13 -0
- data/pgpool2/test/parser/input/misc.sql +28 -0
- data/pgpool2/test/parser/input/prepare.sql +4 -0
- data/pgpool2/test/parser/input/privileges.sql +31 -0
- data/pgpool2/test/parser/input/scanner.sql +34 -0
- data/pgpool2/test/parser/input/select.sql +89 -0
- data/pgpool2/test/parser/input/transaction.sql +38 -0
- data/pgpool2/test/parser/input/update.sql +11 -0
- data/pgpool2/test/parser/input/v84.sql +37 -0
- data/pgpool2/test/parser/input/v90.sql +38 -0
- data/pgpool2/test/parser/input/var.sql +22 -0
- data/pgpool2/test/parser/main.c +96 -0
- data/pgpool2/test/parser/parse_schedule +16 -0
- data/pgpool2/test/parser/pool.h +13 -0
- data/pgpool2/test/parser/run-test +62 -0
- data/pgpool2/test/pdo-test/README.euc_jp +58 -0
- data/pgpool2/test/pdo-test/SQLlist/test1.sql +3 -0
- data/pgpool2/test/pdo-test/SQLlist/test2.sql +3 -0
- data/pgpool2/test/pdo-test/collections.inc +11 -0
- data/pgpool2/test/pdo-test/def.inc +7 -0
- data/pgpool2/test/pdo-test/log.txt +0 -0
- data/pgpool2/test/pdo-test/mod/database.inc +36 -0
- data/pgpool2/test/pdo-test/mod/def.inc +0 -0
- data/pgpool2/test/pdo-test/mod/errorhandler.inc +27 -0
- data/pgpool2/test/pdo-test/pdotest.php +11 -0
- data/pgpool2/test/pdo-test/regsql.inc +56 -0
- data/pgpool2/test/pgpool_setup +898 -0
- data/pgpool2/test/regression/README +39 -0
- data/pgpool2/test/regression/clean.sh +21 -0
- data/pgpool2/test/regression/libs.sh +16 -0
- data/pgpool2/test/regression/regress.sh +166 -0
- data/pgpool2/test/regression/tests/001.load_balance/test.sh +128 -0
- data/pgpool2/test/regression/tests/002.native_replication/PgTester.java +47 -0
- data/pgpool2/test/regression/tests/002.native_replication/create.sql +6 -0
- data/pgpool2/test/regression/tests/002.native_replication/test.sh +71 -0
- data/pgpool2/test/regression/tests/003.failover/expected.r +6 -0
- data/pgpool2/test/regression/tests/003.failover/expected.s +6 -0
- data/pgpool2/test/regression/tests/003.failover/test.sh +45 -0
- data/pgpool2/test/regression/tests/004.watchdog/master.conf +12 -0
- data/pgpool2/test/regression/tests/004.watchdog/standby.conf +19 -0
- data/pgpool2/test/regression/tests/004.watchdog/test.sh +52 -0
- data/pgpool2/test/regression/tests/050.bug58/test.sh +50 -0
- data/pgpool2/test/regression/tests/051.bug60/bug.sql +12 -0
- data/pgpool2/test/regression/tests/051.bug60/database-clean.sql +6 -0
- data/pgpool2/test/regression/tests/051.bug60/database-setup.sql +28 -0
- data/pgpool2/test/regression/tests/051.bug60/test.sh +79 -0
- data/pgpool2/test/regression/tests/052.do_query/test.sh +44 -0
- data/pgpool2/test/regression/tests/053.insert_lock_hangs/test.sh +81 -0
- data/pgpool2/test/regression/tests/054.postgres_fdw/test.sh +67 -0
- data/pgpool2/test/regression/tests/055.backend_all_down/test.sh +52 -0
- data/pgpool2/test/regression/tests/056.bug63/jdbctest2.java +66 -0
- data/pgpool2/test/regression/tests/056.bug63/test.sh +47 -0
- data/pgpool2/test/regression/tests/057.bug61/test.sh +40 -0
- data/pgpool2/test/regression/tests/058.bug68/jdbctest3.java +45 -0
- data/pgpool2/test/regression/tests/058.bug68/test.sh +47 -0
- data/pgpool2/test/timestamp/expected/insert.out +16 -0
- data/pgpool2/test/timestamp/expected/misc.out +3 -0
- data/pgpool2/test/timestamp/expected/update.out +6 -0
- data/pgpool2/test/timestamp/input/insert.sql +16 -0
- data/pgpool2/test/timestamp/input/misc.sql +3 -0
- data/pgpool2/test/timestamp/input/update.sql +6 -0
- data/pgpool2/test/timestamp/main.c +129 -0
- data/pgpool2/test/timestamp/parse_schedule +3 -0
- data/pgpool2/test/timestamp/run-test +69 -0
- data/pgpool2/version.h +1 -0
- data/pgpool2/watchdog/Makefile.am +17 -0
- data/pgpool2/watchdog/Makefile.in +505 -0
- data/pgpool2/watchdog/test/stab.c +266 -0
- data/pgpool2/watchdog/test/test.c +85 -0
- data/pgpool2/watchdog/test/wd_child_t.c +87 -0
- data/pgpool2/watchdog/test/wd_lifecheck_t.c +87 -0
- data/pgpool2/watchdog/test/wd_packet_t.c +87 -0
- data/pgpool2/watchdog/test/wd_ping_t.c +20 -0
- data/pgpool2/watchdog/watchdog.c +408 -0
- data/pgpool2/watchdog/watchdog.h +209 -0
- data/pgpool2/watchdog/wd_child.c +444 -0
- data/pgpool2/watchdog/wd_ext.h +123 -0
- data/pgpool2/watchdog/wd_heartbeat.c +577 -0
- data/pgpool2/watchdog/wd_if.c +216 -0
- data/pgpool2/watchdog/wd_init.c +126 -0
- data/pgpool2/watchdog/wd_interlock.c +347 -0
- data/pgpool2/watchdog/wd_lifecheck.c +512 -0
- data/pgpool2/watchdog/wd_list.c +429 -0
- data/pgpool2/watchdog/wd_packet.c +1159 -0
- data/pgpool2/watchdog/wd_ping.c +330 -0
- data/pgpool2/ylwrap +223 -0
- data/pgsql/presto_client.py +346 -0
- data/pgsql/prestogres.py +156 -0
- data/pgsql/setup_functions.sql +21 -0
- data/pgsql/setup_language.sql +3 -0
- data/prestogres.gemspec +23 -0
- metadata +496 -0
@@ -0,0 +1,518 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* makefuncs.c
|
4
|
+
* creator functions for primitive nodes. The functions here are for
|
5
|
+
* the most frequently created nodes.
|
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/makefuncs.c
|
14
|
+
*
|
15
|
+
*-------------------------------------------------------------------------
|
16
|
+
*/
|
17
|
+
#include "pool_parser.h"
|
18
|
+
|
19
|
+
#include "makefuncs.h"
|
20
|
+
#include "pool_memory.h"
|
21
|
+
#include "pg_class.h"
|
22
|
+
#include <stdlib.h>
|
23
|
+
#include <string.h>
|
24
|
+
|
25
|
+
|
26
|
+
#define BOOLOID 16 /* XXX */
|
27
|
+
|
28
|
+
/*
|
29
|
+
* makeA_Expr -
|
30
|
+
* makes an A_Expr node
|
31
|
+
*/
|
32
|
+
A_Expr *
|
33
|
+
makeA_Expr(A_Expr_Kind kind, List *name,
|
34
|
+
Node *lexpr, Node *rexpr, int location)
|
35
|
+
{
|
36
|
+
A_Expr *a = makeNode(A_Expr);
|
37
|
+
|
38
|
+
a->kind = kind;
|
39
|
+
a->name = name;
|
40
|
+
a->lexpr = lexpr;
|
41
|
+
a->rexpr = rexpr;
|
42
|
+
a->location = location;
|
43
|
+
return a;
|
44
|
+
}
|
45
|
+
|
46
|
+
/*
|
47
|
+
* makeSimpleA_Expr -
|
48
|
+
* As above, given a simple (unqualified) operator name
|
49
|
+
*/
|
50
|
+
A_Expr *
|
51
|
+
makeSimpleA_Expr(A_Expr_Kind kind, char *name,
|
52
|
+
Node *lexpr, Node *rexpr, int location)
|
53
|
+
{
|
54
|
+
A_Expr *a = makeNode(A_Expr);
|
55
|
+
|
56
|
+
a->kind = kind;
|
57
|
+
a->name = list_make1(makeString((char *) name));
|
58
|
+
a->lexpr = lexpr;
|
59
|
+
a->rexpr = rexpr;
|
60
|
+
a->location = location;
|
61
|
+
return a;
|
62
|
+
}
|
63
|
+
|
64
|
+
/*
|
65
|
+
* makeVar -
|
66
|
+
* creates a Var node
|
67
|
+
*/
|
68
|
+
Var *
|
69
|
+
makeVar(Index varno,
|
70
|
+
AttrNumber varattno,
|
71
|
+
Oid vartype,
|
72
|
+
int32 vartypmod,
|
73
|
+
Oid varcollid,
|
74
|
+
Index varlevelsup)
|
75
|
+
{
|
76
|
+
Var *var = makeNode(Var);
|
77
|
+
|
78
|
+
var->varno = varno;
|
79
|
+
var->varattno = varattno;
|
80
|
+
var->vartype = vartype;
|
81
|
+
var->vartypmod = vartypmod;
|
82
|
+
var->varcollid = varcollid;
|
83
|
+
var->varlevelsup = varlevelsup;
|
84
|
+
|
85
|
+
/*
|
86
|
+
* Since few if any routines ever create Var nodes with varnoold/varoattno
|
87
|
+
* different from varno/varattno, we don't provide separate arguments for
|
88
|
+
* them, but just initialize them to the given varno/varattno. This
|
89
|
+
* reduces code clutter and chance of error for most callers.
|
90
|
+
*/
|
91
|
+
var->varnoold = varno;
|
92
|
+
var->varoattno = varattno;
|
93
|
+
|
94
|
+
/* Likewise, we just set location to "unknown" here */
|
95
|
+
var->location = -1;
|
96
|
+
|
97
|
+
return var;
|
98
|
+
}
|
99
|
+
|
100
|
+
#if 0
|
101
|
+
/*
|
102
|
+
* makeVarFromTargetEntry -
|
103
|
+
* convenience function to create a same-level Var node from a
|
104
|
+
* TargetEntry
|
105
|
+
*/
|
106
|
+
Var *
|
107
|
+
makeVarFromTargetEntry(Index varno,
|
108
|
+
TargetEntry *tle)
|
109
|
+
{
|
110
|
+
return makeVar(varno,
|
111
|
+
tle->resno,
|
112
|
+
exprType((Node *) tle->expr),
|
113
|
+
exprTypmod((Node *) tle->expr),
|
114
|
+
exprCollation((Node *) tle->expr),
|
115
|
+
0);
|
116
|
+
}
|
117
|
+
|
118
|
+
/*
|
119
|
+
* makeWholeRowVar -
|
120
|
+
* creates a Var node representing a whole row of the specified RTE
|
121
|
+
*
|
122
|
+
* A whole-row reference is a Var with varno set to the correct range
|
123
|
+
* table entry, and varattno == 0 to signal that it references the whole
|
124
|
+
* tuple. (Use of zero here is unclean, since it could easily be confused
|
125
|
+
* with error cases, but it's not worth changing now.) The vartype indicates
|
126
|
+
* a rowtype; either a named composite type, or RECORD. This function
|
127
|
+
* encapsulates the logic for determining the correct rowtype OID to use.
|
128
|
+
*
|
129
|
+
* If allowScalar is true, then for the case where the RTE is a function
|
130
|
+
* returning a non-composite result type, we produce a normal Var referencing
|
131
|
+
* the function's result directly, instead of the single-column composite
|
132
|
+
* value that the whole-row notation might otherwise suggest.
|
133
|
+
*/
|
134
|
+
Var *
|
135
|
+
makeWholeRowVar(RangeTblEntry *rte,
|
136
|
+
Index varno,
|
137
|
+
Index varlevelsup,
|
138
|
+
bool allowScalar)
|
139
|
+
{
|
140
|
+
Var *result;
|
141
|
+
Oid toid;
|
142
|
+
|
143
|
+
switch (rte->rtekind)
|
144
|
+
{
|
145
|
+
case RTE_RELATION:
|
146
|
+
/* relation: the rowtype is a named composite type */
|
147
|
+
toid = get_rel_type_id(rte->relid);
|
148
|
+
if (!OidIsValid(toid))
|
149
|
+
elog(ERROR, "could not find type OID for relation %u",
|
150
|
+
rte->relid);
|
151
|
+
result = makeVar(varno,
|
152
|
+
InvalidAttrNumber,
|
153
|
+
toid,
|
154
|
+
-1,
|
155
|
+
InvalidOid,
|
156
|
+
varlevelsup);
|
157
|
+
break;
|
158
|
+
case RTE_FUNCTION:
|
159
|
+
toid = exprType(rte->funcexpr);
|
160
|
+
if (type_is_rowtype(toid))
|
161
|
+
{
|
162
|
+
/* func returns composite; same as relation case */
|
163
|
+
result = makeVar(varno,
|
164
|
+
InvalidAttrNumber,
|
165
|
+
toid,
|
166
|
+
-1,
|
167
|
+
InvalidOid,
|
168
|
+
varlevelsup);
|
169
|
+
}
|
170
|
+
else if (allowScalar)
|
171
|
+
{
|
172
|
+
/* func returns scalar; just return its output as-is */
|
173
|
+
result = makeVar(varno,
|
174
|
+
1,
|
175
|
+
toid,
|
176
|
+
-1,
|
177
|
+
exprCollation(rte->funcexpr),
|
178
|
+
varlevelsup);
|
179
|
+
}
|
180
|
+
else
|
181
|
+
{
|
182
|
+
/* func returns scalar, but we want a composite result */
|
183
|
+
result = makeVar(varno,
|
184
|
+
InvalidAttrNumber,
|
185
|
+
RECORDOID,
|
186
|
+
-1,
|
187
|
+
InvalidOid,
|
188
|
+
varlevelsup);
|
189
|
+
}
|
190
|
+
break;
|
191
|
+
default:
|
192
|
+
|
193
|
+
/*
|
194
|
+
* RTE is a join, subselect, or VALUES. We represent this as a
|
195
|
+
* whole-row Var of RECORD type. (Note that in most cases the Var
|
196
|
+
* will be expanded to a RowExpr during planning, but that is not
|
197
|
+
* our concern here.)
|
198
|
+
*/
|
199
|
+
result = makeVar(varno,
|
200
|
+
InvalidAttrNumber,
|
201
|
+
RECORDOID,
|
202
|
+
-1,
|
203
|
+
InvalidOid,
|
204
|
+
varlevelsup);
|
205
|
+
break;
|
206
|
+
}
|
207
|
+
|
208
|
+
return result;
|
209
|
+
}
|
210
|
+
#endif
|
211
|
+
|
212
|
+
/*
|
213
|
+
* makeTargetEntry -
|
214
|
+
* creates a TargetEntry node
|
215
|
+
*/
|
216
|
+
TargetEntry *
|
217
|
+
makeTargetEntry(Expr *expr,
|
218
|
+
AttrNumber resno,
|
219
|
+
char *resname,
|
220
|
+
bool resjunk)
|
221
|
+
{
|
222
|
+
TargetEntry *tle = makeNode(TargetEntry);
|
223
|
+
|
224
|
+
tle->expr = expr;
|
225
|
+
tle->resno = resno;
|
226
|
+
tle->resname = resname;
|
227
|
+
|
228
|
+
/*
|
229
|
+
* We always set these fields to 0. If the caller wants to change them he
|
230
|
+
* must do so explicitly. Few callers do that, so omitting these
|
231
|
+
* arguments reduces the chance of error.
|
232
|
+
*/
|
233
|
+
tle->ressortgroupref = 0;
|
234
|
+
tle->resorigtbl = InvalidOid;
|
235
|
+
tle->resorigcol = 0;
|
236
|
+
|
237
|
+
tle->resjunk = resjunk;
|
238
|
+
|
239
|
+
return tle;
|
240
|
+
}
|
241
|
+
|
242
|
+
/*
|
243
|
+
* flatCopyTargetEntry -
|
244
|
+
* duplicate a TargetEntry, but don't copy substructure
|
245
|
+
*
|
246
|
+
* This is commonly used when we just want to modify the resno or substitute
|
247
|
+
* a new expression.
|
248
|
+
*/
|
249
|
+
TargetEntry *
|
250
|
+
flatCopyTargetEntry(TargetEntry *src_tle)
|
251
|
+
{
|
252
|
+
TargetEntry *tle = makeNode(TargetEntry);
|
253
|
+
|
254
|
+
Assert(IsA(src_tle, TargetEntry));
|
255
|
+
memcpy(tle, src_tle, sizeof(TargetEntry));
|
256
|
+
return tle;
|
257
|
+
}
|
258
|
+
|
259
|
+
/*
|
260
|
+
* makeFromExpr -
|
261
|
+
* creates a FromExpr node
|
262
|
+
*/
|
263
|
+
FromExpr *
|
264
|
+
makeFromExpr(List *fromlist, Node *quals)
|
265
|
+
{
|
266
|
+
FromExpr *f = makeNode(FromExpr);
|
267
|
+
|
268
|
+
f->fromlist = fromlist;
|
269
|
+
f->quals = quals;
|
270
|
+
return f;
|
271
|
+
}
|
272
|
+
|
273
|
+
/*
|
274
|
+
* makeConst -
|
275
|
+
* creates a Const node
|
276
|
+
*/
|
277
|
+
Const *
|
278
|
+
makeConst(Oid consttype,
|
279
|
+
int32 consttypmod,
|
280
|
+
Oid constcollid,
|
281
|
+
int constlen,
|
282
|
+
Datum constvalue,
|
283
|
+
bool constisnull,
|
284
|
+
bool constbyval)
|
285
|
+
{
|
286
|
+
Const *cnst = makeNode(Const);
|
287
|
+
|
288
|
+
cnst->consttype = consttype;
|
289
|
+
cnst->consttypmod = consttypmod;
|
290
|
+
cnst->constcollid = constcollid;
|
291
|
+
cnst->constlen = constlen;
|
292
|
+
cnst->constvalue = constvalue;
|
293
|
+
cnst->constisnull = constisnull;
|
294
|
+
cnst->constbyval = constbyval;
|
295
|
+
cnst->location = -1; /* "unknown" */
|
296
|
+
|
297
|
+
return cnst;
|
298
|
+
}
|
299
|
+
|
300
|
+
#if 0
|
301
|
+
/*
|
302
|
+
* makeNullConst -
|
303
|
+
* creates a Const node representing a NULL of the specified type/typmod
|
304
|
+
*
|
305
|
+
* This is a convenience routine that just saves a lookup of the type's
|
306
|
+
* storage properties.
|
307
|
+
*/
|
308
|
+
Const *
|
309
|
+
makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
|
310
|
+
{
|
311
|
+
int16 typLen;
|
312
|
+
bool typByVal;
|
313
|
+
|
314
|
+
get_typlenbyval(consttype, &typLen, &typByVal);
|
315
|
+
return makeConst(consttype,
|
316
|
+
consttypmod,
|
317
|
+
constcollid,
|
318
|
+
(int) typLen,
|
319
|
+
(Datum) 0,
|
320
|
+
true,
|
321
|
+
typByVal);
|
322
|
+
}
|
323
|
+
#endif
|
324
|
+
|
325
|
+
#if 0
|
326
|
+
/*
|
327
|
+
* makeBoolConst -
|
328
|
+
* creates a Const node representing a boolean value (can be NULL too)
|
329
|
+
*/
|
330
|
+
Node *
|
331
|
+
makeBoolConst(bool value, bool isnull)
|
332
|
+
{
|
333
|
+
/* note that pg_type.h hardwires size of bool as 1 ... duplicate it */
|
334
|
+
return (Node *) makeConst(BOOLOID, -1, InvalidOid, 1,
|
335
|
+
BoolGetDatum(value), isnull, true);
|
336
|
+
}
|
337
|
+
#endif
|
338
|
+
|
339
|
+
/*
|
340
|
+
* makeBoolExpr -
|
341
|
+
* creates a BoolExpr node
|
342
|
+
*/
|
343
|
+
Expr *
|
344
|
+
makeBoolExpr(BoolExprType boolop, List *args, int location)
|
345
|
+
{
|
346
|
+
BoolExpr *b = makeNode(BoolExpr);
|
347
|
+
|
348
|
+
b->boolop = boolop;
|
349
|
+
b->args = args;
|
350
|
+
b->location = location;
|
351
|
+
|
352
|
+
return (Expr *) b;
|
353
|
+
}
|
354
|
+
|
355
|
+
/*
|
356
|
+
* makeAlias -
|
357
|
+
* creates an Alias node
|
358
|
+
*
|
359
|
+
* NOTE: the given name is copied, but the colnames list (if any) isn't.
|
360
|
+
*/
|
361
|
+
Alias *
|
362
|
+
makeAlias(const char *aliasname, List *colnames)
|
363
|
+
{
|
364
|
+
Alias *a = makeNode(Alias);
|
365
|
+
|
366
|
+
a->aliasname = pstrdup(aliasname);
|
367
|
+
a->colnames = colnames;
|
368
|
+
|
369
|
+
return a;
|
370
|
+
}
|
371
|
+
|
372
|
+
/*
|
373
|
+
* makeRelabelType -
|
374
|
+
* creates a RelabelType node
|
375
|
+
*/
|
376
|
+
RelabelType *
|
377
|
+
makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, Oid rcollid,
|
378
|
+
CoercionForm rformat)
|
379
|
+
{
|
380
|
+
RelabelType *r = makeNode(RelabelType);
|
381
|
+
|
382
|
+
r->arg = arg;
|
383
|
+
r->resulttype = rtype;
|
384
|
+
r->resulttypmod = rtypmod;
|
385
|
+
r->resultcollid = rcollid;
|
386
|
+
r->relabelformat = rformat;
|
387
|
+
r->location = -1;
|
388
|
+
|
389
|
+
return r;
|
390
|
+
}
|
391
|
+
|
392
|
+
/*
|
393
|
+
* makeRangeVar -
|
394
|
+
* creates a RangeVar node (rather oversimplified case)
|
395
|
+
*/
|
396
|
+
RangeVar *
|
397
|
+
makeRangeVar(char *schemaname, char *relname, int location)
|
398
|
+
{
|
399
|
+
RangeVar *r = makeNode(RangeVar);
|
400
|
+
|
401
|
+
r->catalogname = NULL;
|
402
|
+
r->schemaname = schemaname;
|
403
|
+
r->relname = relname;
|
404
|
+
r->inhOpt = INH_DEFAULT;
|
405
|
+
r->relpersistence = RELPERSISTENCE_PERMANENT;
|
406
|
+
r->alias = NULL;
|
407
|
+
r->location = location;
|
408
|
+
|
409
|
+
return r;
|
410
|
+
}
|
411
|
+
|
412
|
+
/*
|
413
|
+
* makeTypeName -
|
414
|
+
* build a TypeName node for an unqualified name.
|
415
|
+
*
|
416
|
+
* typmod is defaulted, but can be changed later by caller.
|
417
|
+
*/
|
418
|
+
TypeName *
|
419
|
+
makeTypeName(char *typnam)
|
420
|
+
{
|
421
|
+
return makeTypeNameFromNameList(list_make1(makeString(typnam)));
|
422
|
+
}
|
423
|
+
|
424
|
+
/*
|
425
|
+
* makeTypeNameFromNameList -
|
426
|
+
* build a TypeName node for a String list representing a qualified name.
|
427
|
+
*
|
428
|
+
* typmod is defaulted, but can be changed later by caller.
|
429
|
+
*/
|
430
|
+
TypeName *
|
431
|
+
makeTypeNameFromNameList(List *names)
|
432
|
+
{
|
433
|
+
TypeName *n = makeNode(TypeName);
|
434
|
+
|
435
|
+
n->names = names;
|
436
|
+
n->typmods = NIL;
|
437
|
+
n->typemod = -1;
|
438
|
+
n->location = -1;
|
439
|
+
return n;
|
440
|
+
}
|
441
|
+
|
442
|
+
/*
|
443
|
+
* makeTypeNameFromOid -
|
444
|
+
* build a TypeName node to represent a type already known by OID/typmod.
|
445
|
+
*/
|
446
|
+
TypeName *
|
447
|
+
makeTypeNameFromOid(Oid typeOid, int32 typmod)
|
448
|
+
{
|
449
|
+
TypeName *n = makeNode(TypeName);
|
450
|
+
|
451
|
+
n->typeOid = typeOid;
|
452
|
+
n->typemod = typmod;
|
453
|
+
n->location = -1;
|
454
|
+
return n;
|
455
|
+
}
|
456
|
+
|
457
|
+
/*
|
458
|
+
* makeFuncExpr -
|
459
|
+
* build an expression tree representing a function call.
|
460
|
+
*
|
461
|
+
* The argument expressions must have been transformed already.
|
462
|
+
*/
|
463
|
+
FuncExpr *
|
464
|
+
makeFuncExpr(Oid funcid, Oid rettype, List *args,
|
465
|
+
Oid funccollid, Oid inputcollid, CoercionForm fformat)
|
466
|
+
{
|
467
|
+
FuncExpr *funcexpr;
|
468
|
+
|
469
|
+
funcexpr = makeNode(FuncExpr);
|
470
|
+
funcexpr->funcid = funcid;
|
471
|
+
funcexpr->funcresulttype = rettype;
|
472
|
+
funcexpr->funcretset = false; /* only allowed case here */
|
473
|
+
funcexpr->funcformat = fformat;
|
474
|
+
funcexpr->funccollid = funccollid;
|
475
|
+
funcexpr->inputcollid = inputcollid;
|
476
|
+
funcexpr->args = args;
|
477
|
+
funcexpr->location = -1;
|
478
|
+
|
479
|
+
return funcexpr;
|
480
|
+
}
|
481
|
+
|
482
|
+
/*
|
483
|
+
* makeDefElem -
|
484
|
+
* build a DefElem node
|
485
|
+
*
|
486
|
+
* This is sufficient for the "typical" case with an unqualified option name
|
487
|
+
* and no special action.
|
488
|
+
*/
|
489
|
+
DefElem *
|
490
|
+
makeDefElem(char *name, Node *arg)
|
491
|
+
{
|
492
|
+
DefElem *res = makeNode(DefElem);
|
493
|
+
|
494
|
+
res->defnamespace = NULL;
|
495
|
+
res->defname = name;
|
496
|
+
res->arg = arg;
|
497
|
+
res->defaction = DEFELEM_UNSPEC;
|
498
|
+
|
499
|
+
return res;
|
500
|
+
}
|
501
|
+
|
502
|
+
/*
|
503
|
+
* makeDefElemExtended -
|
504
|
+
* build a DefElem node with all fields available to be specified
|
505
|
+
*/
|
506
|
+
DefElem *
|
507
|
+
makeDefElemExtended(char *nameSpace, char *name, Node *arg,
|
508
|
+
DefElemAction defaction)
|
509
|
+
{
|
510
|
+
DefElem *res = makeNode(DefElem);
|
511
|
+
|
512
|
+
res->defnamespace = nameSpace;
|
513
|
+
res->defname = name;
|
514
|
+
res->arg = arg;
|
515
|
+
res->defaction = defaction;
|
516
|
+
|
517
|
+
return res;
|
518
|
+
}
|