├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── README.build ├── README.euc_jp ├── README.online-recovery ├── TODO ├── ac_func_accept_argtypes.m4 ├── c-compiler.m4 ├── c-library.m4 ├── configure.ac ├── doc.ja ├── Makefile.am └── src │ ├── Makefile.am │ ├── figures │ ├── cluster.gif │ ├── cluster.odp │ ├── cluster_40.gif │ ├── cluster_40.odp │ ├── detach_false_primary.gif │ ├── detach_false_primary.odp │ ├── pgpool_adm.gif │ ├── pgpool_adm.odp │ ├── pgpool_adm.png │ ├── process-diagram.gif │ └── process-diagram.odp │ ├── sgml │ ├── .gitignore │ ├── Makefile.am │ ├── README.links │ ├── advanced.sgml │ ├── biblio.sgml │ ├── client-auth.sgml │ ├── config-last.sgml │ ├── config.sgml │ ├── connection-pooling.sgml │ ├── connection-settings.sgml │ ├── errcodes-table.sgml │ ├── example-AWS.sgml │ ├── example-Aurora.sgml │ ├── example-basic.sgml │ ├── example-cluster.sgml │ ├── example-replication-si-mode.sgml │ ├── examples.sgml │ ├── failover.sgml │ ├── filelist.sgml │ ├── fixrtf │ ├── generate-errcodes-table.pl │ ├── healthcheck.sgml │ ├── history.sgml │ ├── info.sgml │ ├── installation-rpm.sgml │ ├── installation-tips.sgml │ ├── installation.sgml │ ├── intro.sgml │ ├── jadetex.cfg │ ├── legal.sgml │ ├── loadbalance.sgml │ ├── memcache.sgml │ ├── misc-config.sgml │ ├── mk_feature_tables.pl │ ├── notation.sgml │ ├── online-recovery.sgml │ ├── performance.sgml │ ├── pgpool.sgml │ ├── problems.sgml │ ├── ref │ │ ├── allfiles.sgml │ │ ├── pcp_attach_node.sgml │ │ ├── pcp_common_options.sgml │ │ ├── pcp_detach_node.sgml │ │ ├── pcp_health_check_stats.sgml │ │ ├── pcp_invalidate_query_cache.sgml │ │ ├── pcp_log_rotate.sgml │ │ ├── pcp_node_count.sgml │ │ ├── pcp_node_info.sgml │ │ ├── pcp_pool_status.sgml │ │ ├── pcp_proc_count.sgml │ │ ├── pcp_proc_info.sgml │ │ ├── pcp_promote_node.sgml │ │ ├── pcp_recovery_node.sgml │ │ ├── pcp_reload_config.sgml │ │ ├── pcp_stop_pgpool.sgml │ │ ├── pcp_watchdog_info.sgml │ │ ├── pg_enc.sgml │ │ ├── pg_md5.sgml │ │ ├── pgpool.sgml │ │ ├── pgpool_adm_pcp_attach_node.sgml │ │ ├── pgpool_adm_pcp_detach_node.sgml │ │ ├── pgpool_adm_pcp_health_check_stats.sgml │ │ ├── pgpool_adm_pcp_node_count.sgml │ │ ├── pgpool_adm_pcp_node_info.sgml │ │ ├── pgpool_adm_pcp_pool_status.sgml │ │ ├── pgpool_reset.sgml │ │ ├── pgpool_set.sgml │ │ ├── pgpool_set_cache.sgml │ │ ├── pgpool_setup.sgml │ │ ├── pgpool_show.sgml │ │ ├── pgproto.sgml │ │ ├── show_pool_backend_stats.sgml │ │ ├── show_pool_cache.sgml │ │ ├── show_pool_health_check_stats.sgml │ │ ├── show_pool_nodes.sgml │ │ ├── show_pool_pools.sgml │ │ ├── show_pool_processes.sgml │ │ ├── show_pool_status.sgml │ │ ├── show_pool_version.sgml │ │ ├── watchdog_setup.sgml │ │ └── wd_cli.sgml │ ├── reference.sgml │ ├── release-3.1.sgml │ ├── release-3.2.sgml │ ├── release-3.3.sgml │ ├── release-3.4.sgml │ ├── release-3.5.sgml │ ├── release-3.6.sgml │ ├── release-3.7.sgml │ ├── release-4.0.sgml │ ├── release-4.1.sgml │ ├── release-4.2.sgml │ ├── release-4.3.sgml │ ├── release-4.4.sgml │ ├── release-4.5.sgml │ ├── release-4.6.sgml │ ├── release.sgml │ ├── restrictions.sgml │ ├── runtime.sgml │ ├── ssl.sgml │ ├── start.sgml │ ├── stream-check.sgml │ ├── stylesheet-common.xsl │ ├── stylesheet-custom.xsl │ ├── stylesheet-fo.xsl │ ├── stylesheet-hh.xsl │ ├── stylesheet-man.xsl │ ├── stylesheet.css │ ├── stylesheet.dsl │ ├── stylesheet.xsl │ ├── version.sgml │ └── watchdog.sgml │ ├── stylesheet-common.xsl │ ├── stylesheet.css │ ├── stylesheet.dsl │ └── stylesheet.xsl ├── doc ├── Makefile.am └── src │ ├── Makefile.am │ ├── figures │ ├── cluster.gif │ ├── cluster.odp │ ├── cluster_40.gif │ ├── cluster_40.odp │ ├── detach_false_primary.gif │ ├── detach_false_primary.odp │ ├── pgpool_adm.gif │ ├── pgpool_adm.odp │ ├── pgpool_adm.png │ ├── process-diagram.gif │ └── process-diagram.odp │ ├── pgpool-en.sgml │ ├── sgml │ ├── .gitignore │ ├── Makefile.am │ ├── README.links │ ├── advanced.sgml │ ├── biblio.sgml │ ├── client-auth.sgml │ ├── config-last.sgml │ ├── config.sgml │ ├── connection-pooling.sgml │ ├── connection-settings.sgml │ ├── errcodes-table.sgml │ ├── example-AWS.sgml │ ├── example-Aurora.sgml │ ├── example-basic.sgml │ ├── example-cluster.sgml │ ├── example-replication-si-mode.sgml │ ├── examples.sgml │ ├── failover.sgml │ ├── filelist.sgml │ ├── fixrtf │ ├── generate-errcodes-table.pl │ ├── healthcheck.sgml │ ├── history.sgml │ ├── info.sgml │ ├── installation-rpm.sgml │ ├── installation-tips.sgml │ ├── installation.sgml │ ├── intro.sgml │ ├── jadetex.cfg │ ├── legal.sgml │ ├── loadbalance.sgml │ ├── memcache.sgml │ ├── misc-config.sgml │ ├── mk_feature_tables.pl │ ├── notation.sgml │ ├── online-recovery.sgml │ ├── performance.sgml │ ├── pgpool.sgml │ ├── problems.sgml │ ├── ref │ │ ├── allfiles.sgml │ │ ├── pcp_attach_node.sgml │ │ ├── pcp_common_options.sgml │ │ ├── pcp_detach_node.sgml │ │ ├── pcp_health_check_stats.sgml │ │ ├── pcp_invalidate_query_cache.sgml │ │ ├── pcp_log_rotate.sgml │ │ ├── pcp_node_count.sgml │ │ ├── pcp_node_info.sgml │ │ ├── pcp_pool_status.sgml │ │ ├── pcp_proc_count.sgml │ │ ├── pcp_proc_info.sgml │ │ ├── pcp_promote_node.sgml │ │ ├── pcp_recovery_node.sgml │ │ ├── pcp_reload_config.sgml │ │ ├── pcp_stop_pgpool.sgml │ │ ├── pcp_watchdog_info.sgml │ │ ├── pg_enc.sgml │ │ ├── pg_md5.sgml │ │ ├── pgpool.sgml │ │ ├── pgpool_adm_pcp_attach_node.sgml │ │ ├── pgpool_adm_pcp_detach_node.sgml │ │ ├── pgpool_adm_pcp_health_check_stats.sgml │ │ ├── pgpool_adm_pcp_node_count.sgml │ │ ├── pgpool_adm_pcp_node_info.sgml │ │ ├── pgpool_adm_pcp_pool_status.sgml │ │ ├── pgpool_reset.sgml │ │ ├── pgpool_set.sgml │ │ ├── pgpool_set_cache.sgml │ │ ├── pgpool_setup.sgml │ │ ├── pgpool_show.sgml │ │ ├── pgproto.sgml │ │ ├── show_pool_backend_stats.sgml │ │ ├── show_pool_cache.sgml │ │ ├── show_pool_health_check_stats.sgml │ │ ├── show_pool_nodes.sgml │ │ ├── show_pool_pools.sgml │ │ ├── show_pool_processes.sgml │ │ ├── show_pool_status.sgml │ │ ├── show_pool_version.sgml │ │ ├── watchdog_setup.sgml │ │ └── wd_cli.sgml │ ├── reference.sgml │ ├── release-3.1.sgml │ ├── release-3.2.sgml │ ├── release-3.3.sgml │ ├── release-3.4.sgml │ ├── release-3.5.sgml │ ├── release-3.6.sgml │ ├── release-3.7.sgml │ ├── release-4.0.sgml │ ├── release-4.1.sgml │ ├── release-4.2.sgml │ ├── release-4.3.sgml │ ├── release-4.4.sgml │ ├── release-4.5.sgml │ ├── release-4.6.sgml │ ├── release.sgml │ ├── restrictions.sgml │ ├── runtime.sgml │ ├── ssl.sgml │ ├── start.sgml │ ├── stream-check.sgml │ ├── stylesheet-common.xsl │ ├── stylesheet-fo.xsl │ ├── stylesheet-hh.xsl │ ├── stylesheet-man.xsl │ ├── stylesheet.css │ ├── stylesheet.dsl │ ├── stylesheet.xsl │ ├── version.sgml │ └── watchdog.sgml │ ├── stylesheet-common.xsl │ ├── stylesheet.css │ ├── stylesheet.dsl │ └── stylesheet.xsl ├── general.m4 ├── m4 └── docbook.m4 └── src ├── Makefile.am ├── auth ├── .gitignore ├── auth-scram.c ├── md5.c ├── pool_auth.c ├── pool_hba.c └── pool_passwd.c ├── config ├── .gitignore ├── README ├── pool_config.l └── pool_config_variables.c ├── context ├── .gitignore ├── pool_process_context.c ├── pool_query_context.c └── pool_session_context.c ├── include ├── Makefile.am ├── auth │ ├── md5.h │ ├── pool_auth.h │ ├── pool_hba.h │ ├── pool_passwd.h │ ├── scram-common.h │ └── scram.h ├── context │ ├── pool_process_context.h │ ├── pool_query_context.h │ └── pool_session_context.h ├── main │ ├── health_check.h │ ├── pgpool_logger.h │ └── pool_internal_comms.h ├── parser │ ├── explain.h │ ├── extensible.h │ ├── gramparse.h │ ├── keywords.h │ ├── kwlist.h │ ├── kwlist_d.h │ ├── kwlookup.h │ ├── lockoptions.h │ ├── makefuncs.h │ ├── nodes.h │ ├── nodetags.h │ ├── parsenodes.h │ ├── parser.h │ ├── pg_class.h │ ├── pg_config_manual.h │ ├── pg_list.h │ ├── pg_trigger.h │ ├── pg_wchar.h │ ├── pool_parser.h │ ├── primnodes.h │ ├── scanner.h │ ├── scansup.h │ ├── stringinfo.h │ └── value.h ├── pcp │ ├── libpcp_ext.h │ ├── pcp.h │ ├── pcp_stream.h │ ├── pcp_worker.h │ └── recovery.h ├── pgproto │ ├── buffer.h │ ├── extended_query.h │ ├── fe_memutils.h │ ├── pgproto.h │ ├── read.h │ └── send.h ├── pool.h ├── pool_config.h ├── pool_config_variables.h ├── pool_type.h ├── protocol │ ├── pool_connection_pool.h │ ├── pool_pg_utils.h │ ├── pool_process_query.h │ ├── pool_proto_modules.h │ └── protocol_defs.h ├── query_cache │ └── pool_memqcache.h ├── rewrite │ ├── pool_lobj.h │ └── pool_timestamp.h ├── utils │ ├── base64.h │ ├── elog.h │ ├── fe_ports.h │ ├── getopt_long.h │ ├── json.h │ ├── json_writer.h │ ├── memdebug.h │ ├── memnodes.h │ ├── memutils.h │ ├── palloc.h │ ├── pgstrcasecmp.h │ ├── pool_ip.h │ ├── pool_ipc.h │ ├── pool_params.h │ ├── pool_path.h │ ├── pool_process_reporting.h │ ├── pool_relcache.h │ ├── pool_select_walker.h │ ├── pool_signal.h │ ├── pool_ssl.h │ ├── pool_stream.h │ ├── pqexpbuffer.h │ ├── ps_status.h │ ├── psqlscan.h │ ├── psqlscan_int.h │ ├── regex_array.h │ ├── sha2.h │ ├── socket_stream.h │ ├── ssl_utils.h │ ├── statistics.h │ └── timestamp.h ├── version.h └── watchdog │ ├── watchdog.h │ ├── wd_commands.h │ ├── wd_internal_commands.h │ ├── wd_ipc_conn.h │ ├── wd_ipc_defines.h │ ├── wd_json_data.h │ ├── wd_lifecheck.h │ └── wd_utils.h ├── libs ├── Makefile.am └── pcp │ ├── .gitignore │ ├── Makefile.am │ └── pcp.c ├── main ├── .gitignore ├── README.failover ├── health_check.c ├── main.c ├── pgpool_logger.c ├── pgpool_main.c ├── pool_globals.c └── pool_internal_comms.c ├── parser ├── .gitignore ├── Makefile.am ├── README ├── copyfuncs.c ├── gram.y ├── gram_minimal.y ├── gram_template.y ├── keywords.c ├── kwlookup.c ├── list.c ├── makefuncs.c ├── nodes.c ├── outfuncs.c ├── parser.c ├── scan.l ├── scansup.c ├── snprintf.c ├── stringinfo.c ├── value.c └── wchar.c ├── pcp_con ├── .gitignore ├── README.add_pcp_command ├── pcp_child.c ├── pcp_worker.c └── recovery.c ├── pgpool.spec ├── protocol ├── .gitignore ├── CommandComplete.c ├── child.c ├── pool_connection_pool.c ├── pool_pg_utils.c ├── pool_process_query.c ├── pool_proto2.c └── pool_proto_modules.c ├── query_cache ├── .gitignore └── pool_memqcache.c ├── redhat ├── pcp_unix_domain_path.patch ├── pgpool.conf.sample.patch ├── pgpool.init ├── pgpool.service ├── pgpool_log.patch ├── pgpool_rhel.sysconfig ├── pgpool_rhel6.sysconfig ├── pgpool_socket_dir.patch ├── pgpool_sudoers.d └── pgpool_tmpfiles.d ├── rewrite ├── .gitignore ├── pool_lobj.c └── pool_timestamp.c ├── sample ├── pcp.conf.sample ├── pgpool.conf.sample ├── pgpool.conf.sample-stream ├── pgpool.pam ├── pgpool_recovery ├── pool_hba.conf.sample └── scripts │ ├── aws_eip_if_cmd.sh.sample │ ├── aws_rtb_if_cmd.sh.sample │ ├── escalation.sh.sample │ ├── failover.sh.sample │ ├── follow_primary.sh.sample │ ├── pgpool_remote_start.sample │ ├── recovery_1st_stage.sample │ ├── replication_mode_recovery_1st_stage.sample │ └── replication_mode_recovery_2nd_stage.sample ├── sql ├── Makefile ├── insert_lock.sql ├── pgpool-recovery │ ├── .gitignore │ ├── Makefile │ ├── pgpool-recovery.c │ ├── pgpool-recovery.sql.in │ ├── pgpool_recovery--1.0--1.1.sql │ ├── pgpool_recovery--1.0.sql │ ├── pgpool_recovery--1.1--1.2.sql │ ├── pgpool_recovery--1.1.sql │ ├── pgpool_recovery--1.2--1.3.sql │ ├── pgpool_recovery--1.2.sql │ ├── pgpool_recovery--1.3--1.4.sql │ ├── pgpool_recovery--1.3.sql │ ├── pgpool_recovery--1.4.sql │ ├── pgpool_recovery.control │ └── uninstall_pgpool-recovery.sql ├── pgpool-regclass │ ├── .gitignore │ ├── Makefile │ ├── pgpool-regclass.c │ ├── pgpool-regclass.sql.in │ ├── pgpool_regclass--1.0.sql │ ├── pgpool_regclass.control │ └── uninstall_pgpool-regclass.sql └── pgpool_adm │ ├── Makefile │ ├── TODO │ ├── pgpool_adm--1.0--1.1.sql │ ├── pgpool_adm--1.0.sql │ ├── pgpool_adm--1.1--1.2.sql │ ├── pgpool_adm--1.1.sql │ ├── pgpool_adm--1.2--1.3.sql │ ├── pgpool_adm--1.2.sql │ ├── pgpool_adm--1.3--1.4.sql │ ├── pgpool_adm--1.3.sql │ ├── pgpool_adm--1.4--1.5.sql │ ├── pgpool_adm--1.4.sql │ ├── pgpool_adm--1.5.sql │ ├── pgpool_adm.c │ ├── pgpool_adm.control │ └── pgpool_adm.h ├── streaming_replication ├── .gitignore └── pool_worker_child.c ├── test ├── .gitignore ├── C │ ├── Makefile │ └── test_extended.c ├── dml-adaptive-test │ ├── extended-query-test │ │ ├── expected │ │ │ └── disable-load-balance-dml.data │ │ ├── test.sh │ │ └── test_data_files │ │ │ └── disable-load-balance-dml.data │ └── simple-query-test │ │ └── test.sh ├── extended-query-test │ ├── .gitignore │ ├── README │ ├── expected │ │ ├── aborted-transaction.data │ │ ├── bug370-sql-error-followed-by-select.data │ │ ├── disable-load-balance-always-black-function.data │ │ ├── disable-load-balance-always.data │ │ ├── disable-load-balance-default-black-function.data │ │ ├── disable-load-balance-default-simple.data │ │ ├── disable-load-balance-default.data │ │ ├── disable-load-balance-off-black-function.data │ │ ├── disable-load-balance-off.data │ │ ├── disable-load-balance-simple-black-function.data │ │ ├── disable-load-balance-simple.data │ │ ├── disable-load-balance-trans-black-function.data │ │ ├── disable-load-balance-white-function.data │ │ ├── disable-load-balance.data │ │ ├── flush.data │ │ ├── node_js.data │ │ ├── parse-before-bind-2.data │ │ ├── parse-before-bind.data │ │ ├── query-cache-notrans.data │ │ ├── query-cache.data │ │ ├── select-multi-rows.data │ │ ├── sql-error.data │ │ ├── statement_level_load_balance.data │ │ └── unable_to_bind.data │ ├── extra_scripts │ │ ├── disable-load-balance-always-black-function.data │ │ ├── disable-load-balance-always.data │ │ ├── disable-load-balance-default-black-function.data │ │ ├── disable-load-balance-default-simple.data │ │ ├── disable-load-balance-default.data │ │ ├── disable-load-balance-off-black-function.data │ │ ├── disable-load-balance-off.data │ │ ├── disable-load-balance-simple-black-function.data │ │ ├── disable-load-balance-simple.data │ │ ├── disable-load-balance-trans-black-function.data │ │ ├── disable-load-balance-white-function.data │ │ ├── disable-load-balance.data │ │ ├── parse-before-bind-2.data │ │ ├── parse-before-bind.data │ │ └── statement_level_load_balance.data │ ├── test.sh │ ├── tests │ │ ├── aborted-transaction.data │ │ ├── bug370-sql-error-followed-by-select.data │ │ ├── disable-load-balance-always-black-function.data │ │ ├── disable-load-balance-always.data │ │ ├── disable-load-balance-default-black-function.data │ │ ├── disable-load-balance-default-simple.data │ │ ├── disable-load-balance-default.data │ │ ├── disable-load-balance-off-black-function.data │ │ ├── disable-load-balance-off.data │ │ ├── disable-load-balance-simple-black-function.data │ │ ├── disable-load-balance-simple.data │ │ ├── disable-load-balance-trans-black-function.data │ │ ├── disable-load-balance-white-function.data │ │ ├── disable-load-balance.data │ │ ├── flush.data │ │ ├── node_js.data │ │ ├── parse-before-bind-2.data │ │ ├── parse-before-bind.data │ │ ├── query-cache-notrans.data │ │ ├── query-cache.data │ │ ├── select-multi-rows.data │ │ ├── sql-error.data │ │ └── unable_to_bind.data │ └── tests_n3 │ │ └── statement_level_load_balance.data ├── parser │ ├── .cvsignore │ ├── Makefile │ ├── README │ ├── expected │ │ ├── copy.out │ │ ├── create.out │ │ ├── cursor.out │ │ ├── delete.out │ │ ├── drop.out │ │ ├── insert.out │ │ ├── misc.out │ │ ├── prepare.out │ │ ├── privileges.out │ │ ├── scanner.out │ │ ├── select.out │ │ ├── transaction.out │ │ ├── update.out │ │ ├── v84.out │ │ ├── v90.out │ │ └── var.out │ ├── input │ │ ├── alter.sql │ │ ├── copy.sql │ │ ├── create.sql │ │ ├── cursor.sql │ │ ├── delete.sql │ │ ├── drop.sql │ │ ├── insert.sql │ │ ├── misc.sql │ │ ├── prepare.sql │ │ ├── privileges.sql │ │ ├── scanner.sql │ │ ├── select.sql │ │ ├── transaction.sql │ │ ├── update.sql │ │ ├── v84.sql │ │ ├── v90.sql │ │ └── var.sql │ ├── main.c │ ├── parse_schedule │ ├── pool.h │ └── run-test ├── pdo-test │ ├── README.euc_jp │ ├── SQLlist │ │ ├── test1.sql │ │ └── test2.sql │ ├── collections.inc │ ├── def.inc │ ├── mod │ │ ├── database.inc │ │ └── errorhandler.inc │ ├── pdotest.php │ └── regsql.inc ├── pgpool_setup.in ├── regression │ ├── .gitignore │ ├── README │ ├── clean.sh │ ├── libs.sh │ ├── regress.sh │ └── tests │ │ ├── 001.load_balance │ │ ├── .gitignore │ │ ├── expected │ │ │ ├── expected1-r │ │ │ ├── expected1-s │ │ │ ├── expected2-r │ │ │ ├── expected2-s │ │ │ ├── expected3-r │ │ │ ├── expected3-s │ │ │ ├── expected4-r │ │ │ ├── expected5-r │ │ │ ├── expected6-r │ │ │ ├── expected6-s │ │ │ ├── expected7-r │ │ │ ├── expected7-s │ │ │ └── expected8-s │ │ ├── sql │ │ │ ├── 6.sql │ │ │ └── 7.sql │ │ └── test.sh │ │ ├── 002.native_replication │ │ ├── .gitignore │ │ ├── PgTester.java │ │ ├── create.sql │ │ └── test.sh │ │ ├── 003.failover │ │ ├── .gitignore │ │ ├── create_expected.sql │ │ ├── create_expected_node0.sql │ │ └── test.sh │ │ ├── 004.watchdog │ │ ├── .gitignore │ │ ├── leader.conf │ │ ├── standby.conf │ │ └── test.sh │ │ ├── 005.jdbc │ │ ├── .gitignore │ │ ├── AutoCommitTest.java │ │ ├── BatchTest.java │ │ ├── ColumnTest.java │ │ ├── CreateTempTableTest.java │ │ ├── InsertTest.java │ │ ├── LockTest.java │ │ ├── PgpoolTest.java │ │ ├── PrepareThresholdTest.java │ │ ├── README.euc_jp │ │ ├── RunTest.java │ │ ├── SelectTest.java │ │ ├── UpdateTest.java │ │ ├── expected.txt │ │ ├── expected │ │ │ ├── CreateTempTable │ │ │ ├── PrepareThreshold │ │ │ ├── autocommit │ │ │ ├── batch │ │ │ ├── column │ │ │ ├── insert │ │ │ ├── lock │ │ │ ├── select │ │ │ └── update │ │ ├── prepare.sql │ │ ├── run.sh │ │ └── test.sh │ │ ├── 006.memqcache │ │ ├── .gitignore │ │ ├── alter_database1.data │ │ ├── alter_database2.data │ │ ├── alter_database3.data │ │ ├── alter_role.data │ │ ├── alter_table1.data │ │ ├── alter_table2.data │ │ ├── alter_table3.data │ │ ├── expected.1 │ │ ├── expected.2 │ │ ├── expected.3 │ │ ├── expected.4 │ │ ├── expected.5 │ │ ├── expected.6 │ │ ├── expected.7 │ │ ├── expected.n │ │ ├── expected.r │ │ ├── expected.s │ │ ├── expected.txt │ │ ├── jdbctest.java │ │ ├── query_cache_bug1.data │ │ ├── query_cache_bug2.data │ │ ├── query_cache_bug3.data │ │ ├── query_cache_bug4.data │ │ ├── query_cache_bug5.data │ │ ├── query_cache_bug6.data │ │ ├── query_cache_bug7.data │ │ ├── revoke1.data │ │ ├── revoke2.data │ │ ├── revoke3.data │ │ ├── row_security.data │ │ ├── session_authorization.data │ │ ├── set_role1.data │ │ ├── set_role2.data │ │ ├── set_role3.data │ │ ├── set_role4.data │ │ └── test.sh │ │ ├── 007.memqcache-memcached │ │ ├── .gitignore │ │ ├── expected.txt │ │ ├── jdbctest.java │ │ └── test.sh │ │ ├── 008.dbredirect │ │ ├── .gitignore │ │ ├── select.pgbench │ │ ├── select1.pgbench │ │ └── test.sh │ │ ├── 009.sql_comments │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 010.rewrite_timestamp │ │ ├── expected.txt │ │ ├── test.sh │ │ └── timestamp │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ ├── expected │ │ │ ├── insert.out │ │ │ ├── misc.out │ │ │ └── update.out │ │ │ ├── input │ │ │ ├── insert.sql │ │ │ ├── misc.sql │ │ │ └── update.sql │ │ │ ├── main.c │ │ │ ├── parse_schedule │ │ │ └── run-test │ │ ├── 011.watchdog_quorum_failover │ │ ├── .gitignore │ │ ├── leader.conf │ │ ├── standby.conf │ │ ├── standby2.conf │ │ └── test.sh │ │ ├── 012.watchdog_failover_when_quorum_exists │ │ ├── .gitignore │ │ ├── leader.conf │ │ ├── standby.conf │ │ ├── standby2.conf │ │ └── test.sh │ │ ├── 013.watchdog_failover_require_consensus │ │ ├── .gitignore │ │ ├── leader.conf │ │ ├── standby.conf │ │ ├── standby2.conf │ │ └── test.sh │ │ ├── 014.watchdog_test_quorum_bypass │ │ ├── .gitignore │ │ ├── leader.conf │ │ └── test.sh │ │ ├── 015.watchdog_master_and_backend_fail │ │ ├── .gitignore │ │ ├── leader.conf │ │ ├── standby.conf │ │ ├── standby2.conf │ │ └── test.sh │ │ ├── 016.node_0_is_not_primary │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 017.node_0_is_down │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 018.detach_primary │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 019.log_client_messages │ │ ├── .gitignore │ │ ├── test.sh │ │ └── tests │ │ │ ├── copy.data │ │ │ ├── describe.data │ │ │ ├── extended_query.data │ │ │ ├── function.data │ │ │ └── simple.data │ │ ├── 020.allow_clear_text_frontend_auth │ │ └── test.sh │ │ ├── 021.pool_passwd_auth │ │ ├── pool_hba.conf │ │ └── test.sh │ │ ├── 022.pool_passwd_alternative_auth │ │ ├── pool_hba.conf │ │ └── test.sh │ │ ├── 023.ssl_connection │ │ ├── README │ │ ├── server.crt │ │ ├── server.key │ │ ├── server.req │ │ └── test.sh │ │ ├── 024.cert_auth │ │ ├── cert.sh │ │ └── test.sh │ │ ├── 025.enable_shared_relcache │ │ └── test.sh │ │ ├── 026.temp_table │ │ ├── expected.txt │ │ ├── temp_table.sql │ │ └── test.sh │ │ ├── 027.auto_failback │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 028.watchdog_enable_consensus_with_half_votes │ │ └── test.sh │ │ ├── 029.cert_passphrase │ │ ├── cert.sh │ │ └── test.sh │ │ ├── 030.snapshot_isolation │ │ ├── expected.txt │ │ ├── inconsistency1.sql │ │ ├── inconsistency2.sql │ │ └── test.sh │ │ ├── 031.connection_life_time │ │ └── test.sh │ │ ├── 032.dml_adaptive_load_balance │ │ └── test.sh │ │ ├── 033.prefer_lower_standby_delay │ │ └── test.sh │ │ ├── 034.promote_node │ │ └── test.sh │ │ ├── 035.unix_sockets │ │ └── test.sh │ │ ├── 036.trusted_servers │ │ └── test.sh │ │ ├── 037.failover_session │ │ └── test.sh │ │ ├── 038.pcp_commands │ │ └── test.sh │ │ ├── 039.log_backend_messages │ │ ├── expected.i │ │ ├── expected.n │ │ ├── expected.s │ │ ├── pgproto.data │ │ └── test.sh │ │ ├── 040.client_auth │ │ ├── client_auth_2node.csv │ │ ├── create_ldap_user.sh │ │ ├── create_pam_user.sh │ │ ├── del_ldap_users.sh │ │ ├── del_pam_users.sh │ │ ├── list_ldap_user.sh │ │ ├── list_pam_user.sh │ │ ├── pam_users.txt │ │ └── test.sh │ │ ├── 050.bug58 │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 051.bug60 │ │ ├── .gitignore │ │ ├── bug.sql │ │ ├── database-clean.sql │ │ ├── database-setup.sql │ │ └── test.sh │ │ ├── 052.do_query │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 053.insert_lock_hangs │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 054.postgres_fdw │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 055.backend_all_down │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 056.bug63 │ │ ├── .gitignore │ │ ├── jdbctest2.java │ │ └── test.sh │ │ ├── 057.bug61 │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 058.bug68 │ │ ├── .gitignore │ │ ├── jdbctest3.java │ │ └── test.sh │ │ ├── 059.bug92 │ │ ├── .gitignore │ │ ├── jdbctest.java │ │ └── test.sh │ │ ├── 060.memory_leak │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 061.cancel_query │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 062.select_error_hangs │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 063.tables_with_space │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 064.bug153 │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 065.bug152 │ │ ├── .gitignore │ │ ├── Main.java │ │ ├── run.sh │ │ └── test.sh │ │ ├── 066.bug230 │ │ ├── .gitignore │ │ ├── Sample.java │ │ └── test.sh │ │ ├── 067.bug231 │ │ ├── .gitignore │ │ ├── TestReplGap.java │ │ └── test.sh │ │ ├── 068.memqcache_bug │ │ ├── .gitignore │ │ ├── Sample.java │ │ └── test.sh │ │ ├── 069.memory_leak_extended │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 070.memory_leak_extended_memqcache │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 071.execute_and_deallocate │ │ ├── .gitignore │ │ └── test.sh │ │ ├── 072.meqcache_bug2 │ │ ├── extended_query_test.data │ │ └── test.sh │ │ ├── 073.pg_terminate_backend │ │ └── test.sh │ │ ├── 074.bug700_memqcache_segfault │ │ ├── expected.txt │ │ ├── pgproto.data │ │ └── test.sh │ │ ├── 075.detach_primary_left_down_node │ │ └── test.sh │ │ ├── 076.copy_hang │ │ ├── pgproto.data │ │ └── test.sh │ │ ├── 077.invalid_failover_node │ │ └── test.sh │ │ ├── 078.aborted_transaction │ │ ├── expected.txt │ │ └── test.sh │ │ ├── 079.multi_prepare │ │ ├── expected.txt │ │ ├── pgproto.data │ │ └── test.sh │ │ ├── 080.declare │ │ ├── expected.txt │ │ ├── pgproto.data │ │ └── test.sh │ │ ├── 081.detach_primary_all_down │ │ └── test.sh │ │ └── 082.guard_against_bad_protocol │ │ ├── pgproto.data │ │ ├── pgproto2.data │ │ └── test.sh └── watchdog_setup.in ├── tools ├── .gitignore ├── Makefile.am ├── fe_memutils.c ├── fe_port.c ├── pcp │ ├── .gitignore │ ├── Makefile.am │ └── pcp_frontend_client.c ├── pgenc │ ├── .gitignore │ ├── Makefile.am │ └── pg_enc.c ├── pgmd5 │ ├── .gitignore │ ├── Makefile.am │ └── pg_md5.c ├── pgproto │ ├── .gitignore │ ├── Makefile.am │ ├── buffer.c │ ├── extended_query.c │ ├── fe_memutils.c │ ├── main.c │ ├── read.c │ └── send.c └── watchdog │ ├── .gitignore │ ├── Makefile.am │ └── wd_cli.c ├── utils ├── .gitignore ├── base64.c ├── error │ ├── .gitignore │ ├── assert.c │ └── elog.c ├── getopt_long.c ├── json.c ├── json_writer.c ├── mmgr │ ├── .gitignore │ ├── aset.c │ └── mcxt.c ├── pcp │ ├── .gitignore │ └── pcp_stream.c ├── pg_strong_random.c ├── pgstrcasecmp.c ├── pool_health_check_stats.c ├── pool_ip.c ├── pool_params.c ├── pool_path.c ├── pool_process_reporting.c ├── pool_relcache.c ├── pool_select_walker.c ├── pool_sema.c ├── pool_shmem.c ├── pool_signal.c ├── pool_ssl.c ├── pool_stream.c ├── pqexpbuffer.c ├── ps_status.c ├── psprintf.c ├── psqlscan.l ├── regex_array.c ├── scram-common.c ├── sha2.c ├── socket_stream.c ├── sprompt.c ├── ssl_utils.c ├── statistics.c └── strlcpy.c └── watchdog ├── Makefile.am ├── watchdog.c ├── wd_commands.c ├── wd_escalation.c ├── wd_heartbeat.c ├── wd_if.c ├── wd_internal_commands.c ├── wd_ipc_conn.c ├── wd_json_data.c ├── wd_lifecheck.c ├── wd_ping.c └── wd_utils.c /.gitignore: -------------------------------------------------------------------------------- 1 | # emacs autosave files. You need to change to "#:#" if you are using git 2 | # 1.6.1 or before. 3 | \#*# 4 | *~ 5 | *.o 6 | *.a 7 | *.so 8 | *.lo 9 | *.la 10 | *.orig 11 | *.patch 12 | .deps/ 13 | .libs/ 14 | Makefile 15 | TAGS 16 | tags 17 | autom4te.cache/ 18 | config.h 19 | config.log 20 | config.status 21 | libtool 22 | pcp/pcp_attach_node 23 | pcp/pcp_detach_node 24 | pcp/pcp_node_count 25 | pcp/pcp_node_info 26 | pcp/pcp_pool_status 27 | pcp/pcp_proc_count 28 | pcp/pcp_proc_info 29 | pcp/pcp_promote_node 30 | pcp/pcp_recovery_node 31 | pcp/pcp_stop_pgpool 32 | pcp/pcp_systemdb_info 33 | pg_md5 34 | pgpool 35 | pgpool.8 36 | sql/pgpool-recovery/pgpool-recovery.sql 37 | sql/pgpool-regclass/pgpool-regclass.sql 38 | stamp-h1 39 | Makefile.in 40 | src/include/config.h.in 41 | 42 | # Local excludes in root directory 43 | /aclocal.m4 44 | /compile 45 | /configure 46 | /config.guess 47 | /config.sub 48 | /depcomp 49 | /install-sh 50 | /ltmain.sh 51 | /missing 52 | /mkinstalldirs 53 | /ylwrap 54 | /m4/libtool.m4 55 | /m4/ltoptions.m4 56 | /m4/ltsugar.m4 57 | /m4/ltversion.m4 58 | /m4/lt~obsolete.m4 59 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Authors of pgpool 2 | 3 | pgpool was originally written by Tatsuo Ishii, then was contributed to 4 | pgpool Global Development Group. 5 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003-2021 PgPool Global Development Group 2 | 3 | Permission to use, copy, modify, and distribute this software and 4 | its documentation for any purpose and without fee is hereby 5 | granted, provided that the above copyright notice appear in all 6 | copies and that both that copyright notice and this permission 7 | notice appear in supporting documentation, and that the name of the 8 | author not be used in advertising or publicity pertaining to 9 | distribution of the software without specific, written prior 10 | permission. The author makes no representations about the 11 | suitability of this software for any purpose. It is provided "as 12 | is" without express or implied warranty. 13 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | See NEWS. 2 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | #AM_CPPFLAGS = -D_GNU_SOURCE -I @PGSQL_INCLUDE_DIR@ 2 | AUTOMAKE_OPTIONS = subdir-objects 3 | 4 | # suggested by libtoolize 5 | ACLOCAL_AMFLAGS = -I m4 6 | 7 | docs: 8 | $(MAKE) -C doc all && $(MAKE) -C doc.ja all && $(MAKE) 9 | .PHONY: docs 10 | 11 | SUBDIRS = src 12 | DIST_SUBDIRS = src doc doc.ja 13 | 14 | 15 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | See the file doc/pgpool-en.html 2 | -------------------------------------------------------------------------------- /README.euc_jp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/README.euc_jp -------------------------------------------------------------------------------- /doc.ja/Makefile.am: -------------------------------------------------------------------------------- 1 | # suggested by libtoolize 2 | ACLOCAL_AMFLAGS = -I m4 3 | DEFS = @DEFS@ \ 4 | -DDEFAULT_CONFIGDIR=\"$(sysconfdir)\" 5 | 6 | SUBDIRS = src 7 | -------------------------------------------------------------------------------- /doc.ja/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # suggested by libtoolize 2 | ACLOCAL_AMFLAGS = -I m4 3 | DEFS = @DEFS@ \ 4 | -DDEFAULT_CONFIGDIR=\"$(sysconfdir)\" 5 | 6 | EXTRA_DIST = figures/process-diagram.gif figures/process-diagram.odp \ 7 | figures/cluster.gif figures/cluster.odp 8 | 9 | SUBDIRS = sgml 10 | 11 | -------------------------------------------------------------------------------- /doc.ja/src/figures/cluster.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/cluster.gif -------------------------------------------------------------------------------- /doc.ja/src/figures/cluster.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/cluster.odp -------------------------------------------------------------------------------- /doc.ja/src/figures/cluster_40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/cluster_40.gif -------------------------------------------------------------------------------- /doc.ja/src/figures/cluster_40.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/cluster_40.odp -------------------------------------------------------------------------------- /doc.ja/src/figures/detach_false_primary.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/detach_false_primary.gif -------------------------------------------------------------------------------- /doc.ja/src/figures/detach_false_primary.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/detach_false_primary.odp -------------------------------------------------------------------------------- /doc.ja/src/figures/pgpool_adm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/pgpool_adm.gif -------------------------------------------------------------------------------- /doc.ja/src/figures/pgpool_adm.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/pgpool_adm.odp -------------------------------------------------------------------------------- /doc.ja/src/figures/pgpool_adm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/pgpool_adm.png -------------------------------------------------------------------------------- /doc.ja/src/figures/process-diagram.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/process-diagram.gif -------------------------------------------------------------------------------- /doc.ja/src/figures/process-diagram.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc.ja/src/figures/process-diagram.odp -------------------------------------------------------------------------------- /doc.ja/src/sgml/.gitignore: -------------------------------------------------------------------------------- 1 | HTML.index 2 | bookindex.sgml 3 | html/ 4 | man-stamp 5 | man1/ 6 | man3/ 7 | pgpool.xml 8 | -------------------------------------------------------------------------------- /doc.ja/src/sgml/biblio.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Bibliography 5 | 6 | 7 | Proceedings and Articles 8 | 9 | 10 | 11 | <ulink 12 | url="http://www.vldb.org/pvldb/vol2/vldb09-694.pdf">Pangea: An 13 | Eager Database Replication Middleware guaranteeing Snapshot 14 | Isolation without modification of Database Servers</ulink> 15 | 16 | 17 | Takeshi 18 | Mishima 19 | 20 | 21 | Hiroshi 22 | Nakamura 23 | 24 | 25 | 26 | 27 | VLDB Conference 28 | Aug. 2009 29 |
Lyon, France
30 |
31 |
32 | 33 |
34 |
35 | -------------------------------------------------------------------------------- /doc.ja/src/sgml/config-last.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc.ja/src/sgml/examples.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 例集 8 | 9 | 10 | 11 | 14 | 様々な例 15 | 16 | 17 | 18 | 19 | 20 | 23 | 設定の例 24 | &example-basic; 25 | &example-cluster; 26 | &example-replication-si-mode; 27 | &example-AWS; 28 | &example-Aurora; 29 | 30 | 31 | -------------------------------------------------------------------------------- /doc.ja/src/sgml/fixrtf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # fixrtf 3 | 4 | # doc/src/sgml/fixrtf 5 | 6 | # Repair (slightly) damaged RTF generated by jade 7 | # Applixware wants the s0 stylesheet defined, whereas 8 | # M$Word does not care about it. 9 | # (c) 2001, Thomas Lockhart, PostgreSQL Inc. 10 | 11 | flist="" 12 | RPAT="" 13 | for i in $@ ; do 14 | case "$i" in 15 | -r|--refentry) 16 | RPAT='-e s/\\\keepn/\\\keep/g' 17 | ;; 18 | -?|--help) 19 | echo "$0 [--refentry] ..." 20 | exit 0 21 | ;; 22 | -*) 23 | echo "Command $i not recognized" 24 | $0 --help 25 | exit 1 26 | ;; 27 | *) 28 | flist="$flist $i" 29 | esac 30 | done 31 | 32 | if [ "$flist" = "" ] ; then 33 | flist=*.rtf 34 | fi 35 | 36 | for f in $flist ; do 37 | echo -n "Repairing '$f' ..." 38 | if [ -r $f ] ; then 39 | (sed -e 's/{\\stylesheet{\\s1/{\\stylesheet{\\s0 Normal 0;}{\\s1/g' $RPAT $f > $f.new \ 40 | && mv -f $f.new $f \ 41 | && echo " done") || echo " failed" 42 | else 43 | echo " file not found" 44 | fi 45 | done 46 | exit 47 | -------------------------------------------------------------------------------- /doc.ja/src/sgml/problems.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | バグ報告の指針 8 | 9 | 10 | 13 | Pgpool-IIのバグを見つけたら、バグ管理システムに登録してください。 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc.ja/src/sgml/version.sgml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /doc.ja/src/stylesheet.dsl: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | ]]> 7 | 8 | 10 | ]]> 11 | ]> 12 | 13 | 14 | 15 | 16 | ;; customize the print stylesheet 17 | 18 | 19 | 20 | 21 | 22 | 23 | ;; customize the html stylesheet 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # suggested by libtoolize 2 | ACLOCAL_AMFLAGS = -I m4 3 | DEFS = @DEFS@ \ 4 | -DDEFAULT_CONFIGDIR=\"$(sysconfdir)\" 5 | 6 | SUBDIRS = src 7 | -------------------------------------------------------------------------------- /doc/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # suggested by libtoolize 2 | ACLOCAL_AMFLAGS = -I m4 3 | DEFS = @DEFS@ \ 4 | -DDEFAULT_CONFIGDIR=\"$(sysconfdir)\" 5 | 6 | EXTRA_DIST = figures/process-diagram.gif \ 7 | figures/process-diagram.odp \ 8 | figures/cluster.gif \ 9 | figures/cluster.odp 10 | 11 | SUBDIRS = sgml 12 | 13 | -------------------------------------------------------------------------------- /doc/src/figures/cluster.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/cluster.gif -------------------------------------------------------------------------------- /doc/src/figures/cluster.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/cluster.odp -------------------------------------------------------------------------------- /doc/src/figures/cluster_40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/cluster_40.gif -------------------------------------------------------------------------------- /doc/src/figures/cluster_40.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/cluster_40.odp -------------------------------------------------------------------------------- /doc/src/figures/detach_false_primary.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/detach_false_primary.gif -------------------------------------------------------------------------------- /doc/src/figures/detach_false_primary.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/detach_false_primary.odp -------------------------------------------------------------------------------- /doc/src/figures/pgpool_adm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/pgpool_adm.gif -------------------------------------------------------------------------------- /doc/src/figures/pgpool_adm.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/pgpool_adm.odp -------------------------------------------------------------------------------- /doc/src/figures/pgpool_adm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/pgpool_adm.png -------------------------------------------------------------------------------- /doc/src/figures/process-diagram.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/process-diagram.gif -------------------------------------------------------------------------------- /doc/src/figures/process-diagram.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/doc/src/figures/process-diagram.odp -------------------------------------------------------------------------------- /doc/src/pgpool-en.sgml: -------------------------------------------------------------------------------- 1 | 3 | %version; 4 | ]> 5 | 6 | pgpool-II english documentation 7 | 8 | pgpool-doc-en 9 | &version; 10 | 11 | 12 | Hello pgpool-II! 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /doc/src/sgml/.gitignore: -------------------------------------------------------------------------------- 1 | HTML.index 2 | bookindex.sgml 3 | html/ 4 | man-stamp 5 | man1/ 6 | man3/ 7 | pgpool.xml 8 | -------------------------------------------------------------------------------- /doc/src/sgml/biblio.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Bibliography 5 | 6 | 7 | Proceedings and Articles 8 | 9 | 10 | 11 | <ulink 12 | url="http://www.vldb.org/pvldb/vol2/vldb09-694.pdf">Pangea: An 13 | Eager Database Replication Middleware guaranteeing Snapshot 14 | Isolation without modification of Database Servers</ulink> 15 | 16 | 17 | Takeshi 18 | Mishima 19 | 20 | 21 | Hiroshi 22 | Nakamura 23 | 24 | 25 | 26 | 27 | VLDB Conference 28 | Aug. 2009 29 |
Lyon, France
30 |
31 |
32 | 33 |
34 |
35 | -------------------------------------------------------------------------------- /doc/src/sgml/config-last.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/src/sgml/examples.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Examples 5 | 6 | 7 | 8 | Various examples 9 | 10 | 11 | 12 | 13 | Configuration Examples 14 | &example-basic; 15 | &example-cluster; 16 | &example-replication-si-mode; 17 | &example-AWS; 18 | &example-Aurora; 19 | 20 | 21 | -------------------------------------------------------------------------------- /doc/src/sgml/fixrtf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # fixrtf 3 | 4 | # doc/src/sgml/fixrtf 5 | 6 | # Repair (slightly) damaged RTF generated by jade 7 | # Applixware wants the s0 stylesheet defined, whereas 8 | # M$Word does not care about it. 9 | # (c) 2001, Thomas Lockhart, PostgreSQL Inc. 10 | 11 | flist="" 12 | RPAT="" 13 | for i in $@ ; do 14 | case "$i" in 15 | -r|--refentry) 16 | RPAT='-e s/\\\keepn/\\\keep/g' 17 | ;; 18 | -?|--help) 19 | echo "$0 [--refentry] ..." 20 | exit 0 21 | ;; 22 | -*) 23 | echo "Command $i not recognized" 24 | $0 --help 25 | exit 1 26 | ;; 27 | *) 28 | flist="$flist $i" 29 | esac 30 | done 31 | 32 | if [ "$flist" = "" ] ; then 33 | flist=*.rtf 34 | fi 35 | 36 | for f in $flist ; do 37 | echo -n "Repairing '$f' ..." 38 | if [ -r $f ] ; then 39 | (sed -e 's/{\\stylesheet{\\s1/{\\stylesheet{\\s0 Normal 0;}{\\s1/g' $RPAT $f > $f.new \ 40 | && mv -f $f.new $f \ 41 | && echo " done") || echo " failed" 42 | else 43 | echo " file not found" 44 | fi 45 | done 46 | exit 47 | -------------------------------------------------------------------------------- /doc/src/sgml/problems.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Bug Reporting Guidelines 5 | 6 | 7 | When you find a bug in Pgpool-II, please register to our bug tracking system. 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/src/sgml/ref/pcp_proc_count.sgml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | pcp_proc_count 9 | 10 | 11 | 12 | pcp_proc_count 13 | 1 14 | PCP Command 15 | 16 | 17 | 18 | pcp_proc_count 19 | 20 | displays the list of Pgpool-II children process IDs 21 | 22 | 23 | 24 | 25 | pcp_proc_count 26 | options 27 | 28 | 29 | 30 | 31 | Description 32 | 33 | pcp_proc_count 34 | displays the list of Pgpool-II children process IDs. If there is more than one process, IDs will be delimited by a white space. 35 | 36 | 37 | 38 | 39 | Options 40 | 41 | See . 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /doc/src/sgml/version.sgml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /doc/src/stylesheet.dsl: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | ]]> 7 | 8 | 10 | ]]> 11 | ]> 12 | 13 | 14 | 15 | 16 | ;; customize the print stylesheet 17 | 18 | 19 | 20 | 21 | 22 | 23 | ;; customize the html stylesheet 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/auth/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/config/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | pool_config.c 3 | -------------------------------------------------------------------------------- /src/context/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # suggested by libtoolize 2 | ACLOCAL_AMFLAGS = -I m4 3 | DEFS = @DEFS@ \ 4 | -DDEFAULT_CONFIGDIR=\"$(sysconfdir)\" 5 | 6 | EXTRA_DIST = auth \ 7 | context query_cache\ 8 | parser pool.h pcp pool_type.h pool_config.h protocol rewrite version.h utils watchdog config.h config.h.in pool_config_variables.h pgproto main 9 | -------------------------------------------------------------------------------- /src/include/auth/md5.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * md5.h 4 | * Interface to md5.c 5 | * 6 | * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group 7 | * Portions Copyright (c) 1994, Regents of the University of California 8 | * 9 | * $Header$ 10 | * 11 | *------------------------------------------------------------------------- 12 | */ 13 | 14 | /* 15 | * This file is imported from PostgreSQL 8.1.3. 16 | * Modified by Taiki Yamaguchi 17 | */ 18 | 19 | #ifndef MD5_H 20 | #define MD5_H 21 | 22 | #define MD5_PASSWD_LEN 32 23 | 24 | #define WD_AUTH_HASH_LEN 64 25 | 26 | extern int pool_md5_hash(const void *buff, size_t len, char *hexsum); 27 | extern int pool_md5_encrypt(const char *passwd, const char *salt, size_t salt_len, char *buf); 28 | extern void bytesToHex(char *b, int len, char *s); 29 | extern bool pg_md5_encrypt(const char *passwd, const char *salt, size_t salt_len, char *buf); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/include/parser/keywords.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * keywords.h 4 | * PostgreSQL's list of SQL keywords 5 | * 6 | * 7 | * Portions Copyright (c) 2003-2024, PgPool Global Development Group 8 | * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group 9 | * Portions Copyright (c) 1994, Regents of the University of California 10 | * 11 | * src/include/common/keywords.h 12 | * 13 | *------------------------------------------------------------------------- 14 | */ 15 | #ifndef KEYWORDS_H 16 | #define KEYWORDS_H 17 | 18 | #include "kwlookup.h" 19 | 20 | /* Keyword categories --- should match lists in gram.y */ 21 | #define UNRESERVED_KEYWORD 0 22 | #define COL_NAME_KEYWORD 1 23 | #define TYPE_FUNC_NAME_KEYWORD 2 24 | #define RESERVED_KEYWORD 3 25 | 26 | extern PGDLLIMPORT const ScanKeywordList ScanKeywords; 27 | extern PGDLLIMPORT const uint8 ScanKeywordCategories[]; 28 | extern PGDLLIMPORT const bool ScanKeywordBareLabel[]; 29 | 30 | #endif /* KEYWORDS_H */ 31 | -------------------------------------------------------------------------------- /src/include/parser/scansup.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * scansup.h 4 | * scanner support routines used by the core lexer 5 | * 6 | * Portions Copyright (c) 2003-2024, PgPool Global Development Group 7 | * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group 8 | * Portions Copyright (c) 1994, Regents of the University of California 9 | * 10 | * src/include/parser/scansup.h 11 | * 12 | *------------------------------------------------------------------------- 13 | */ 14 | 15 | #ifndef SCANSUP_H 16 | #define SCANSUP_H 17 | 18 | extern char *downcase_truncate_identifier(const char *ident, int len, 19 | bool warn); 20 | 21 | extern char *downcase_identifier(const char *ident, int len, 22 | bool warn, bool truncate); 23 | 24 | extern void truncate_identifier(char *ident, int len, bool warn); 25 | 26 | extern bool scanner_isspace(char ch); 27 | 28 | #endif /* SCANSUP_H */ 29 | -------------------------------------------------------------------------------- /src/include/pcp/pcp_worker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * pgpool: a language independent connection pool server for PostgreSQL 4 | * written by Tatsuo Ishii 5 | * 6 | * Copyright (c) 2003-2020 PgPool Global Development Group 7 | * 8 | * Permission to use, copy, modify, and distribute this software and 9 | * its documentation for any purpose and without fee is hereby 10 | * granted, provided that the above copyright notice appear in all 11 | * copies and that both that copyright notice and this permission 12 | * notice appear in supporting documentation, and that the name of the 13 | * author not be used in advertising or publicity pertaining to 14 | * distribution of the software without specific, written prior 15 | * permission. The author makes no representations about the 16 | * suitability of this software for any purpose. It is provided "as 17 | * is" without express or implied warranty. 18 | * 19 | * 20 | */ 21 | 22 | #ifndef pcp_worker_h 23 | #define pcp_worker_h 24 | 25 | extern int send_to_pcp_frontend(char *data, int len, bool flush); 26 | extern int pcp_frontend_exists(void); 27 | extern void pcp_worker_main(int port); 28 | extern void pcp_mark_recovery_finished(void); 29 | extern bool pcp_mark_recovery_in_progress(void); 30 | 31 | 32 | #endif /* pcp_worker_h */ 33 | -------------------------------------------------------------------------------- /src/include/pcp/recovery.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * pgpool: a language independent connection pool server for PostgreSQL 4 | * written by Tatsuo Ishii 5 | * 6 | * Copyright (c) 2003-2020 PgPool Global Development Group 7 | * 8 | * Permission to use, copy, modify, and distribute this software and 9 | * its documentation for any purpose and without fee is hereby 10 | * granted, provided that the above copyright notice appear in all 11 | * copies and that both that copyright notice and this permission 12 | * notice appear in supporting documentation, and that the name of the 13 | * author not be used in advertising or publicity pertaining to 14 | * distribution of the software without specific, written prior 15 | * permission. The author makes no representations about the 16 | * suitability of this software for any purpose. It is provided "as 17 | * is" without express or implied warranty. 18 | * 19 | */ 20 | 21 | 22 | #ifndef recovery_h 23 | #define recovery_h 24 | 25 | extern void start_recovery(int recovery_node); 26 | extern void finish_recovery(void); 27 | extern int wait_connection_closed(void); 28 | extern int ensure_conn_counter_validity(void); 29 | 30 | #endif /* recovery_h */ 31 | -------------------------------------------------------------------------------- /src/include/pgproto/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Tatsuo Ishii 3 | * 4 | * Permission to use, copy, modify, and distribute this software and 5 | * its documentation for any purpose and without fee is hereby 6 | * granted, provided that the above copyright notice appear in all 7 | * copies and that both that copyright notice and this permission 8 | * notice appear in supporting documentation, and that the name of the 9 | * author not be used in advertising or publicity pertaining to 10 | * distribution of the software without specific, written prior 11 | * permission. The author makes no representations about the 12 | * suitability of this software for any purpose. It is provided "as 13 | * is" without express or implied warranty. 14 | */ 15 | 16 | #ifndef BUFFER_H 17 | 18 | #define BUFFER_H 19 | 20 | #define SKIP_TABS(p) while (*p == '\t') {p++;} 21 | 22 | extern int buffer_read_int(char *buf, char **bufp); 23 | extern char *buffer_read_string(char *buf, char **bufp); 24 | extern char buffer_read_char(char *buf, char **bufp); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/include/pgproto/extended_query.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Tatsuo Ishii 3 | * 4 | * Permission to use, copy, modify, and distribute this software and 5 | * its documentation for any purpose and without fee is hereby 6 | * granted, provided that the above copyright notice appear in all 7 | * copies and that both that copyright notice and this permission 8 | * notice appear in supporting documentation, and that the name of the 9 | * author not be used in advertising or publicity pertaining to 10 | * distribution of the software without specific, written prior 11 | * permission. The author makes no representations about the 12 | * suitability of this software for any purpose. It is provided "as 13 | * is" without express or implied warranty. 14 | * 15 | * Process Parse, Bind, Execute message. 16 | */ 17 | 18 | #ifndef EXTENDED_QUERY_H 19 | #define EXTENDED_QUERY_H 20 | 21 | extern void process_parse(char *buf, PGconn *conn); 22 | extern void process_bind(char *buf, PGconn *conn); 23 | extern void process_execute(char *buf, PGconn *conn); 24 | extern void process_describe(char *buf, PGconn *conn); 25 | extern void process_close(char *buf, PGconn *conn); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/include/pgproto/read.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Tatsuo Ishii 3 | * 4 | * Permission to use, copy, modify, and distribute this software and 5 | * its documentation for any purpose and without fee is hereby 6 | * granted, provided that the above copyright notice appear in all 7 | * copies and that both that copyright notice and this permission 8 | * notice appear in supporting documentation, and that the name of the 9 | * author not be used in advertising or publicity pertaining to 10 | * distribution of the software without specific, written prior 11 | * permission. The author makes no representations about the 12 | * suitability of this software for any purpose. It is provided "as 13 | * is" without express or implied warranty. 14 | */ 15 | 16 | #ifndef READ_H 17 | #define READ_H 18 | 19 | extern void read_until_ready_for_query(PGconn *conn, int check_input, int wait_for_ready_for_query); 20 | #endif 21 | -------------------------------------------------------------------------------- /src/include/pgproto/send.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Tatsuo Ishii 3 | * 4 | * Permission to use, copy, modify, and distribute this software and 5 | * its documentation for any purpose and without fee is hereby 6 | * granted, provided that the above copyright notice appear in all 7 | * copies and that both that copyright notice and this permission 8 | * notice appear in supporting documentation, and that the name of the 9 | * author not be used in advertising or publicity pertaining to 10 | * distribution of the software without specific, written prior 11 | * permission. The author makes no representations about the 12 | * suitability of this software for any purpose. It is provided "as 13 | * is" without express or implied warranty. 14 | */ 15 | 16 | #ifndef SEND_H 17 | #define SEND_H 18 | 19 | extern void send_char(char c, PGconn *conn); 20 | extern void send_int(int intval, PGconn *conn); 21 | extern void send_int16(short shortval, PGconn *conn); 22 | extern void send_string(char *buf, PGconn *conn); 23 | extern void send_byte(char *buf, int len, PGconn *conn); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/include/utils/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * base64.h 3 | * Encoding and decoding routines for base64 without whitespace 4 | * support. 5 | * 6 | * Portions Copyright (c) 2001-2017, PostgreSQL Global Development Group 7 | * 8 | * src/include/common/base64.h 9 | */ 10 | #ifndef BASE64_H 11 | #define BASE64_H 12 | 13 | /* base 64 */ 14 | extern int pg_b64_encode(const char *src, int len, char *dst); 15 | extern int pg_b64_decode(const char *src, int len, char *dst); 16 | extern int pg_b64_enc_len(int srclen); 17 | extern int pg_b64_dec_len(int srclen); 18 | 19 | #endif /* BASE64_H */ 20 | -------------------------------------------------------------------------------- /src/include/utils/getopt_long.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Portions Copyright (c) 1987, 1993, 1994 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Portions Copyright (c) 2003-2010, PostgreSQL Global Development Group 6 | * 7 | * $PostgreSQL: pgsql/src/include/getopt_long.h,v 1.12 2010-01-02 16:58:00 momjian Exp $ 8 | */ 9 | #ifndef GETOPT_LONG_H 10 | #define GETOPT_LONG_H 11 | 12 | #ifdef HAVE_GETOPT_H 13 | #include 14 | #endif 15 | 16 | /* These are picked up from the system's getopt() facility. */ 17 | extern int opterr; 18 | extern int optind; 19 | extern int optopt; 20 | extern char *optarg; 21 | extern int optreset; 22 | 23 | #ifndef HAVE_STRUCT_OPTION 24 | 25 | struct option 26 | { 27 | const char *name; 28 | int has_arg; 29 | int *flag; 30 | int val; 31 | }; 32 | 33 | #define no_argument 0 34 | #define required_argument 1 35 | #endif 36 | 37 | #ifndef HAVE_GETOPT_LONG 38 | 39 | extern int getopt_long(int argc, char *const argv[], 40 | const char *optstring, 41 | const struct option *longopts, int *longindex); 42 | #endif 43 | 44 | #endif /* GETOPT_LONG_H */ 45 | -------------------------------------------------------------------------------- /src/include/utils/pgstrcasecmp.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * pgstrcasecmp.h 4 | * Header for src/utils/pgstrcasecmp.c compatibility functions. 5 | * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group 6 | * Portions Copyright (c) 1994, Regents of the University of California 7 | * 8 | * src/include/utils/pgstrcasecmp.h 9 | * 10 | *------------------------------------------------------------------------- 11 | */ 12 | #ifndef POOL_PGSTRCASECMP 13 | #define POOL_PGSTRCASECMP 14 | 15 | /* msb for char */ 16 | #define HIGHBIT (0x80) 17 | #define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT) 18 | 19 | 20 | /* Portable SQL-like case-independent comparisons and conversions */ 21 | extern int pg_strcasecmp(const char *s1, const char *s2); 22 | extern int pg_strncasecmp(const char *s1, const char *s2, size_t n); 23 | extern unsigned char pg_toupper(unsigned char ch); 24 | extern unsigned char pg_tolower(unsigned char ch); 25 | extern unsigned char pg_ascii_toupper(unsigned char ch); 26 | extern unsigned char pg_ascii_tolower(unsigned char ch); 27 | #endif 28 | -------------------------------------------------------------------------------- /src/include/version.h: -------------------------------------------------------------------------------- 1 | #define PGPOOLVERSION "tasukiboshi" 2 | 3 | -------------------------------------------------------------------------------- /src/libs/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = pcp 2 | 3 | -------------------------------------------------------------------------------- /src/libs/pcp/.gitignore: -------------------------------------------------------------------------------- 1 | json.c 2 | md5.c 3 | pcp_stream.c 4 | -------------------------------------------------------------------------------- /src/libs/pcp/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -D_GNU_SOURCE -DPOOL_PRIVATE -I @PGSQL_INCLUDE_DIR@ 2 | 3 | lib_LTLIBRARIES = libpcp.la 4 | libpcp_la_LDFLAGS = -version-info 2:0:0 5 | dist_libpcp_la_SOURCES = pcp.c \ 6 | ../../utils/pool_path.c \ 7 | ../../tools/fe_port.c \ 8 | ../../tools/fe_memutils.c \ 9 | ../../utils/strlcpy.c \ 10 | ../../utils/pool_health_check_stats.c 11 | nodist_libpcp_la_SOURCES = pcp_stream.c \ 12 | md5.c \ 13 | json.c 14 | 15 | include_HEADERS = ../../../src/include/pcp/pcp.h \ 16 | ../../../src/include/pcp/libpcp_ext.h \ 17 | ../../../src/include/pool_type.h \ 18 | ../../../src/include/utils/pool_process_reporting.h 19 | 20 | md5.c: ../../../src/auth/md5.c 21 | rm -f $@ && ln -s $< . 22 | pcp_stream.c: ../../../src/utils/pcp/pcp_stream.c 23 | rm -f $@ && ln -s $< . 24 | json.c: ../../../src/utils/json.c 25 | rm -f $@ && ln -s $< . 26 | 27 | clean-local: 28 | -rm -f $(nodist_libpcp_la_SOURCES) 29 | -------------------------------------------------------------------------------- /src/main/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/parser/.gitignore: -------------------------------------------------------------------------------- 1 | /gram.c 2 | /gram.h 3 | /gram_minimal.c 4 | /gram_minimal.h 5 | /scan.c 6 | -------------------------------------------------------------------------------- /src/parser/Makefile.am: -------------------------------------------------------------------------------- 1 | parser_incdir = $(top_srcdir)/src/include/parser 2 | AM_CPPFLAGS = -D_GNU_SOURCE -I $(parser_incdir) -I @PGSQL_INCLUDE_DIR@ 3 | noinst_LIBRARIES = libsql-parser.a 4 | 5 | libsql_parser_a_SOURCES = \ 6 | copyfuncs.c \ 7 | gram.y \ 8 | gram_minimal.y \ 9 | keywords.c \ 10 | kwlookup.c \ 11 | list.c \ 12 | makefuncs.c \ 13 | nodes.c \ 14 | outfuncs.c \ 15 | parser.c \ 16 | scansup.c \ 17 | stringinfo.c \ 18 | value.c \ 19 | $(top_srcdir)/src/utils/mmgr/mcxt.c \ 20 | $(top_srcdir)/src/utils/mmgr/aset.c \ 21 | $(top_srcdir)/src/utils/error/elog.c \ 22 | wchar.c scan.c 23 | 24 | if use_repl_snprintf 25 | libsql_parser_a_SOURCES += snprintf.c 26 | endif 27 | 28 | EXTRA_DIST = scan.l 29 | ARFLAGS = cr 30 | 31 | AM_YFLAGS = -d -Wno-yacc 32 | 33 | gram.c: gram.y scan.c 34 | gram_minimal.c: gram_minimal.y scan.c 35 | 36 | scan.c: scan.l 37 | $(LEX) -o'scan.c' $< 38 | 39 | generate_parsers: gram_template.y 40 | $(SUNIFDEF) --undef pgpool_minimal_parser gram_template.y > gram.y||: 41 | $(SUNIFDEF) --define pgpool_minimal_parser gram_template.y > gram_minimal.y||: 42 | 43 | .PHONY: generate_parsers 44 | -------------------------------------------------------------------------------- /src/parser/nodes.c: -------------------------------------------------------------------------------- 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-2023, PgPool Global Development Group 8 | * Portions Copyright (c) 1996-2023, 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 | 21 | #include "../pool_type.h" 22 | #include "nodes.h" 23 | 24 | /* 25 | * Support for newNode() macro 26 | * 27 | * In a GCC build there is no need for the global variable newNodeMacroHolder. 28 | * However, we create it anyway, to support the case of a non-GCC-built 29 | * loadable module being loaded into a GCC-built backend. 30 | */ 31 | 32 | Node *newNodeMacroHolder; 33 | -------------------------------------------------------------------------------- /src/pcp_con/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/protocol/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/query_cache/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/redhat/pcp_unix_domain_path.patch: -------------------------------------------------------------------------------- 1 | *** src/include/pcp/pcp_stream.h 2020-07-31 09:24:10.835496879 +0900 2 | --- pcp_stream.h 2020-07-31 09:24:02.598396128 +0900 3 | *************** 4 | *** 49,54 **** 5 | extern int pcp_write(PCP_CONNECTION * pc, void *buf, int len); 6 | extern int pcp_flush(PCP_CONNECTION * pc); 7 | 8 | ! #define UNIX_DOMAIN_PATH "/tmp" 9 | 10 | #endif /* PCP_STREAM_H */ 11 | --- 49,54 ---- 12 | extern int pcp_write(PCP_CONNECTION * pc, void *buf, int len); 13 | extern int pcp_flush(PCP_CONNECTION * pc); 14 | 15 | ! #define UNIX_DOMAIN_PATH "/var/run/postgresql" 16 | 17 | #endif /* PCP_STREAM_H */ 18 | -------------------------------------------------------------------------------- /src/redhat/pgpool.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Pgpool-II 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | 7 | User=postgres 8 | Group=postgres 9 | 10 | EnvironmentFile=-/etc/sysconfig/pgpool 11 | 12 | ExecStart=/usr/bin/pgpool -f /etc/pgpool-II/pgpool.conf $OPTS 13 | ExecStop=/usr/bin/pgpool -f /etc/pgpool-II/pgpool.conf $STOP_OPTS stop 14 | ExecReload=/usr/bin/pgpool -f /etc/pgpool-II/pgpool.conf reload 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /src/redhat/pgpool_rhel.sysconfig: -------------------------------------------------------------------------------- 1 | # Options for pgpool 2 | 3 | # -n: don't run in daemon mode. does not detach control tty 4 | # -d: debug mode. lots of debug information will be printed 5 | 6 | #OPTS=" -d -n" 7 | OPTS=" -n" 8 | 9 | STOP_OPTS=" -m fast" 10 | -------------------------------------------------------------------------------- /src/redhat/pgpool_rhel6.sysconfig: -------------------------------------------------------------------------------- 1 | # Options for pgpool 2 | 3 | # -n: don't run in daemon mode. does not detach control tty 4 | # -d: debug mode. lots of debug information will be printed 5 | 6 | #OPTS=" -d -n" 7 | OPTS=" -n" 8 | -------------------------------------------------------------------------------- /src/redhat/pgpool_sudoers.d: -------------------------------------------------------------------------------- 1 | postgres ALL=NOPASSWD: /sbin/ip 2 | postgres ALL=NOPASSWD: /usr/sbin/arping 3 | -------------------------------------------------------------------------------- /src/redhat/pgpool_tmpfiles.d: -------------------------------------------------------------------------------- 1 | d /run/pgpool 0755 postgres postgres - 2 | -------------------------------------------------------------------------------- /src/rewrite/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/sample/pcp.conf.sample: -------------------------------------------------------------------------------- 1 | # PCP Client Authentication Configuration File 2 | # ============================================ 3 | # 4 | # This file contains user ID and his password for pgpool 5 | # communication manager authentication. 6 | # 7 | # Note that users defined here do not need to be PostgreSQL 8 | # users. These users are authorized ONLY for pgpool 9 | # communication manager. 10 | # 11 | # File Format 12 | # =========== 13 | # 14 | # List one UserID and password on a single line. They must 15 | # be concatenated together using ':' (colon) between them. 16 | # No spaces or tabs are allowed anywhere in the line. 17 | # 18 | # Example: 19 | # postgres:e8a48653851e28c69d0506508fb27fc5 20 | # 21 | # Be aware that there will be no spaces or tabs at the 22 | # beginning of the line! although the above example looks 23 | # like so. 24 | # 25 | # Lines beginning with '#' (pound) are comments and will 26 | # be ignored. Again, no spaces or tabs allowed before '#'. 27 | 28 | # USERID:MD5PASSWD 29 | -------------------------------------------------------------------------------- /src/sample/pgpool.conf.sample: -------------------------------------------------------------------------------- 1 | pgpool.conf.sample-stream -------------------------------------------------------------------------------- /src/sample/pgpool.pam: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | # create your own PAM configurations 3 | -------------------------------------------------------------------------------- /src/sample/pgpool_recovery: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $# -ne 4 ] 4 | then 5 | echo "pgpool_recovery datadir remote_host remote_datadir primary_port" 6 | exit 1 7 | fi 8 | 9 | datadir=$1 10 | DEST=$2 11 | DESTDIR=$3 12 | PORT=$4 13 | 14 | rsync -acurz --delete -e ssh $datadir/global/ $DEST:$DESTDIR/global/ & 15 | rsync -acurz --delete -e ssh $datadir/base/ $DEST:$DESTDIR/base/ & 16 | rsync -acurz --delete -e ssh $datadir/pg_multixact/ $DEST:$DESTDIR/pg_multixact/ & 17 | rsync -acurz --delete -e ssh $datadir/pg_subtrans/ $DEST:$DESTDIR/pg_subtrans/ & 18 | rsync -acurz --delete -e ssh $datadir/pg_clog/ $DEST:$DESTDIR/pg_clog/ & 19 | rsync -acurz --delete -e ssh $datadir/pg_xlog/ $DEST:$DESTDIR/pg_xlog/ & 20 | rsync -acurz --delete -e ssh $datadir/pg_twophase/ $DEST:$DESTDIR/pg_twophase/ & 21 | wait 22 | -------------------------------------------------------------------------------- /src/sample/scripts/escalation.sh.sample: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script is run by wd_escalation_command to bring down the virtual IP on other pgpool nodes 3 | # before bringing up the virtual IP on the new active pgpool node. 4 | 5 | set -o xtrace 6 | 7 | POSTGRESQL_STARTUP_USER=postgres 8 | SSH_KEY_FILE=id_rsa_pgpool 9 | SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/${SSH_KEY_FILE}" 10 | SSH_TIMEOUT=5 11 | PGPOOLS=(server1 server2 server3) 12 | 13 | VIP=192.168.100.50 14 | DEVICE=enp0s8 15 | CIDR_NETMASK=24 16 | 17 | for pgpool in "${PGPOOLS[@]}"; do 18 | [ "$HOSTNAME" = "${pgpool}" ] && continue 19 | 20 | timeout ${SSH_TIMEOUT} ssh -T ${SSH_OPTIONS} ${POSTGRESQL_STARTUP_USER}@${pgpool} " 21 | /sbin/ip addr show dev ${DEVICE} | grep ${VIP} > /dev/null 2>&1 22 | " 23 | 24 | if [ $? -eq 0 ]; then 25 | timeout ${SSH_TIMEOUT} ssh -T ${SSH_OPTIONS} ${POSTGRESQL_STARTUP_USER}@${pgpool} " 26 | /usr/bin/sudo /sbin/ip addr del ${VIP}/${CIDR_NETMASK} dev ${DEVICE} 27 | " 28 | 29 | if [ $? -ne 0 ]; then 30 | echo ERROR: escalation.sh: failed to release VIP on ${pgpool}. 31 | fi 32 | fi 33 | done 34 | exit 0 35 | -------------------------------------------------------------------------------- /src/sql/insert_lock.sql: -------------------------------------------------------------------------------- 1 | -- Create lock control table for tables using sequence in native replication mode. 2 | 3 | DROP TABLE pgpool_catalog.insert_lock; 4 | 5 | CREATE SCHEMA pgpool_catalog; 6 | CREATE TABLE pgpool_catalog.insert_lock(reloid OID PRIMARY KEY); 7 | 8 | -- this row is used as the row lock target when pgpool inserts new oid 9 | INSERT INTO pgpool_catalog.insert_lock VALUES (0); 10 | 11 | -- allow "SELECT ... FOR UPDATE" and "INSERT ..." to all roles 12 | GRANT USAGE ON SCHEMA pgpool_catalog TO PUBLIC; 13 | GRANT SELECT ON pgpool_catalog.insert_lock TO PUBLIC; 14 | GRANT UPDATE ON pgpool_catalog.insert_lock TO PUBLIC; 15 | GRANT INSERT ON pgpool_catalog.insert_lock TO PUBLIC; 16 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/.gitignore: -------------------------------------------------------------------------------- 1 | pgpool-recovery.sql 2 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/Makefile: -------------------------------------------------------------------------------- 1 | MODULES = pgpool-recovery 2 | DATA_built = pgpool-recovery.sql 3 | DATA = uninstall_pgpool-recovery.sql 4 | 5 | EXTENSION = pgpool_recovery 6 | DATA = pgpool_recovery--1.1.sql pgpool_recovery--1.2.sql pgpool_recovery--1.1--1.2.sql \ 7 | pgpool_recovery--1.3.sql pgpool_recovery--1.2--1.3.sql \ 8 | pgpool_recovery--1.4.sql pgpool_recovery--1.3--1.4.sql 9 | 10 | # if you are using PostgreSQL 8.0 or later, 11 | # using pg_config is recommended. 12 | # if you are not, comment out following line and... 13 | USE_PGXS = true 14 | # set top_builddir to the PostgreSQL build source tree top. 15 | # (for example /usr/local/src/postgresql-8.4) 16 | top_builddir = ../.. 17 | 18 | ifdef USE_PGXS 19 | PG_CONFIG ?= pg_config 20 | PGXS = $(shell $(PG_CONFIG) --pgxs) 21 | include $(PGXS) 22 | else 23 | subdir = contrib/pgpool-recovery 24 | #top_builddir = ../.. 25 | include $(top_builddir)/src/Makefile.global 26 | include $(top_srcdir)/contrib/contrib-global.mk 27 | endif 28 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/pgpool_recovery--1.0--1.1.sql: -------------------------------------------------------------------------------- 1 | /* contrib/pgpool_recovery/pgpool_recovery--1.0--1.1.sql */ 2 | 3 | -- complain if script is sourced in psql, rather than via ALTER EXTENSION 4 | \echo Use "ALTER EXTENSION pgpool_recovery UPDATE TO '1.1'" to load this file. \quit 5 | 6 | create FUNCTION pgpool_recovery(script_name text, remote_host text, remote_data_directory text, remote_port text) 7 | RETURNS bool 8 | AS 'MODULE_PATHNAME', 'pgpool_recovery' 9 | LANGUAGE C STRICT; 10 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/pgpool_recovery--1.0.sql: -------------------------------------------------------------------------------- 1 | -- complain if script is sourced in psql, rather than via CREATE EXTENSION 2 | \echo Use "CREATE EXTENSION pgpool_recovery" to load this file. \quit 3 | 4 | CREATE FUNCTION pgpool_recovery(IN script_name text, 5 | IN remote_host text, 6 | IN remote_data_directory text) 7 | RETURNS bool 8 | AS 'MODULE_PATHNAME', 'pgpool_recovery' 9 | LANGUAGE C STRICT; 10 | 11 | CREATE FUNCTION pgpool_remote_start(IN remote_host text, IN remote_data_directory text) 12 | RETURNS bool 13 | AS 'MODULE_PATHNAME', 'pgpool_remote_start' 14 | LANGUAGE C STRICT; 15 | 16 | CREATE FUNCTION pgpool_pgctl(IN action text, IN stop_mode text) 17 | RETURNS bool 18 | AS '$libdir/pgpool-recovery', 'pgpool_pgctl' 19 | LANGUAGE C STRICT; 20 | 21 | CREATE FUNCTION pgpool_switch_xlog(IN archive_dir text) 22 | RETURNS text 23 | AS 'MODULE_PATHNAME', 'pgpool_switch_xlog' 24 | LANGUAGE C STRICT; 25 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/pgpool_recovery--1.1--1.2.sql: -------------------------------------------------------------------------------- 1 | /* contrib/pgpool_recovery/pgpool_recovery--1.1--1.2.sql */ 2 | 3 | -- complain if script is sourced in psql, rather than via ALTER EXTENSION 4 | \echo Use "ALTER EXTENSION pgpool_recovery UPDATE TO '1.2'" to load this file. \quit 5 | 6 | create FUNCTION pgpool_recovery(script_name text, remote_host text, remote_data_directory text, primary_port text, remote_node integer) 7 | RETURNS bool 8 | AS 'MODULE_PATHNAME', 'pgpool_recovery' 9 | LANGUAGE C STRICT; 10 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/pgpool_recovery--1.1.sql: -------------------------------------------------------------------------------- 1 | -- complain if script is sourced in psql, rather than via CREATE EXTENSION 2 | \echo Use "CREATE EXTENSION pgpool_recovery" to load this file. \quit 3 | 4 | CREATE FUNCTION pgpool_recovery(IN script_name text, 5 | IN remote_host text, 6 | IN remote_data_directory text, 7 | IN remote_port text) 8 | RETURNS bool 9 | AS 'MODULE_PATHNAME', 'pgpool_recovery' 10 | LANGUAGE C STRICT; 11 | 12 | CREATE FUNCTION pgpool_recovery(IN script_name text, 13 | IN remote_host text, 14 | IN remote_data_directory text) 15 | RETURNS bool 16 | AS 'MODULE_PATHNAME', 'pgpool_recovery' 17 | LANGUAGE C STRICT; 18 | 19 | CREATE FUNCTION pgpool_remote_start(IN remote_host text, IN remote_data_directory text) 20 | RETURNS bool 21 | AS 'MODULE_PATHNAME', 'pgpool_remote_start' 22 | LANGUAGE C STRICT; 23 | 24 | CREATE FUNCTION pgpool_pgctl(IN action text, IN stop_mode text) 25 | RETURNS bool 26 | AS '$libdir/pgpool-recovery', 'pgpool_pgctl' 27 | LANGUAGE C STRICT; 28 | 29 | CREATE FUNCTION pgpool_switch_xlog(IN archive_dir text) 30 | RETURNS text 31 | AS 'MODULE_PATHNAME', 'pgpool_switch_xlog' 32 | LANGUAGE C STRICT; 33 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/pgpool_recovery--1.2--1.3.sql: -------------------------------------------------------------------------------- 1 | /* contrib/pgpool_recovery/pgpool_recovery--1.2--1.3.sql */ 2 | 3 | -- complain if script is sourced in psql, rather than via ALTER EXTENSION 4 | \echo Use "ALTER EXTENSION pgpool_recovery UPDATE TO '1.3'" to load this file. \quit 5 | 6 | create FUNCTION pgpool_recovery(script_name text, remote_host text, remote_data_directory text, primary_port text, remote_node integer, remote_port text) 7 | RETURNS bool 8 | AS 'MODULE_PATHNAME', 'pgpool_recovery' 9 | LANGUAGE C STRICT; 10 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/pgpool_recovery--1.3--1.4.sql: -------------------------------------------------------------------------------- 1 | /* contrib/pgpool_recovery/pgpool_recovery--1.3--1.4.sql */ 2 | 3 | -- complain if script is sourced in psql, rather than via ALTER EXTENSION 4 | \echo Use "ALTER EXTENSION pgpool_recovery UPDATE TO '1.4'" to load this file. \quit 5 | 6 | create FUNCTION pgpool_recovery(script_name text, remote_host text, remote_data_directory text, primary_port text, remote_node integer, remote_port text, primary_host text) 7 | RETURNS bool 8 | AS 'MODULE_PATHNAME', 'pgpool_recovery' 9 | LANGUAGE C STRICT; 10 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/pgpool_recovery.control: -------------------------------------------------------------------------------- 1 | # pgpool-recovery extension 2 | comment = 'recovery functions for pgpool-II for V4.3' 3 | default_version = '1.4' 4 | module_pathname = '$libdir/pgpool-recovery' 5 | relocatable = true 6 | -------------------------------------------------------------------------------- /src/sql/pgpool-recovery/uninstall_pgpool-recovery.sql: -------------------------------------------------------------------------------- 1 | DROP FUNCTION pgpool_switch_xlog(text); 2 | DROP FUNCTION pgpool_remote_start(text, text); 3 | DROP FUNCTION pgpool_recovery(text, text, text); 4 | -------------------------------------------------------------------------------- /src/sql/pgpool-regclass/.gitignore: -------------------------------------------------------------------------------- 1 | pgpool-regclass.sql 2 | -------------------------------------------------------------------------------- /src/sql/pgpool-regclass/Makefile: -------------------------------------------------------------------------------- 1 | MODULES = pgpool-regclass 2 | DATA_built = pgpool-regclass.sql 3 | DATA = uninstall_pgpool-regclass.sql 4 | 5 | EXTENSION = pgpool_regclass 6 | DATA = pgpool_regclass--1.0.sql 7 | 8 | # if you are using PostgreSQL 8.0 or later, 9 | # using pg_config is recommended. 10 | # if you are not, comment out following line and... 11 | USE_PGXS = true 12 | # set top_builddir to the PostgreSQL build source tree top. 13 | # (for example /usr/local/src/postgresql-8.4) 14 | top_builddir = ../.. 15 | 16 | ifdef USE_PGXS 17 | PG_CONFIG ?= pg_config 18 | PGXS = $(shell $(PG_CONFIG) --pgxs) 19 | include $(PGXS) 20 | else 21 | subdir = contrib/pgpool-regclass 22 | #top_builddir = ../.. 23 | include $(top_builddir)/src/Makefile.global 24 | include $(top_srcdir)/contrib/contrib-global.mk 25 | endif 26 | -------------------------------------------------------------------------------- /src/sql/pgpool-regclass/pgpool-regclass.sql.in: -------------------------------------------------------------------------------- 1 | CREATE FUNCTION pg_catalog.pgpool_regclass(cstring) 2 | RETURNS oid 3 | AS 'MODULE_PATHNAME', 'pgpool_regclass' 4 | LANGUAGE C STRICT; 5 | -------------------------------------------------------------------------------- /src/sql/pgpool-regclass/pgpool_regclass--1.0.sql: -------------------------------------------------------------------------------- 1 | -- complain if script is sourced in psql, rather than via CREATE EXTENSION 2 | \echo Use "CREATE EXTENSION pgpool_regclass" to load this file. \quit 3 | 4 | CREATE FUNCTION pg_catalog.pgpool_regclass(IN expression cstring) 5 | RETURNS oid 6 | AS 'MODULE_PATHNAME', 'pgpool_regclass' 7 | LANGUAGE C STRICT; 8 | -------------------------------------------------------------------------------- /src/sql/pgpool-regclass/pgpool_regclass.control: -------------------------------------------------------------------------------- 1 | # pgpool-regclass extension 2 | comment = 'replacement for regclass' 3 | default_version = '1.0' 4 | module_pathname = '$libdir/pgpool-regclass' 5 | relocatable = true 6 | -------------------------------------------------------------------------------- /src/sql/pgpool-regclass/uninstall_pgpool-regclass.sql: -------------------------------------------------------------------------------- 1 | DROP FUNCTION pgpool_regclass(cstring); 2 | -------------------------------------------------------------------------------- /src/sql/pgpool_adm/Makefile: -------------------------------------------------------------------------------- 1 | # contrib/pgpool_adm/Makefile 2 | 3 | MODULE_big = pgpool_adm 4 | OBJS = pgpool_adm.o 5 | PG_CPPFLAGS = -I$(libpq_srcdir) -I../../include/pcp -DPGPOOL_ADM 6 | 7 | EXTENSION = pgpool_adm 8 | DATA = pgpool_adm--1.0.sql pgpool_adm--1.1.sql pgpool_adm--1.2.sql pgpool_adm--1.3.sql \ 9 | pgpool_adm--1.0--1.1.sql pgpool_adm--1.1--1.2.sql pgpool_adm--1.2--1.3.sql \ 10 | pgpool_adm--1.4.sql pgpool_adm--1.3--1.4.sql \ 11 | pgpool_adm--1.5.sql pgpool_adm--1.4--1.5.sql 12 | SHLIB_LINK = -L../../libs/pcp/.libs -lpcp -Wl,--as-needed -Wl,-rpath,'${prefix}/lib',--enable-new-dtags 13 | # if you are using PostgreSQL 8.0 or later, 14 | # using pg_config is recommended. 15 | # if you are not, comment out following line and... 16 | USE_PGXS = true 17 | # set top_builddir to the PostgreSQL build source tree top. 18 | # (for example /usr/local/src/postgresql-8.4) 19 | top_builddir = ../.. 20 | 21 | ifdef USE_PGXS 22 | PG_CONFIG ?= pg_config 23 | PGXS := $(shell $(PG_CONFIG) --pgxs) 24 | include $(PGXS) 25 | else 26 | subdir = contrib/pgpool_adm 27 | #top_builddir = ../.. 28 | include $(top_builddir)/src/Makefile.global 29 | include $(top_srcdir)/contrib/contrib-global.mk 30 | endif 31 | -------------------------------------------------------------------------------- /src/sql/pgpool_adm/TODO: -------------------------------------------------------------------------------- 1 | * pcp_proc_count 2 | * pcp_proc_info 3 | * pcp_promote_node 4 | * pcp_recovery_node 5 | * pcp_stop_pgpool 6 | * pcp_systemdb_info 7 | * anything else ? 8 | -------------------------------------------------------------------------------- /src/sql/pgpool_adm/pgpool_adm--1.0--1.1.sql: -------------------------------------------------------------------------------- 1 | /* contrib/pgpool_adm/pgpool_adm--1.0--1.1.sql */ 2 | 3 | -- complain if script is sourced in psql, rather than via ALTER EXTENSION 4 | \echo Use "ALTER EXTENSION pgpool_adm UPDATE TO '1.1'" to load this file. \quit 5 | 6 | ALTER EXTENSION pgpool_adm DROP FUNCTION pcp_node_info(integer, text, integer, text, text, OUT host text, OUT port integer, OUT status text, OUT weight float4); 7 | DROP FUNCTION pcp_node_info(integer, text, integer, text, text, OUT host text, OUT port integer, OUT status text, OUT weight float4); 8 | 9 | CREATE FUNCTION pcp_node_info(integer, text, integer, text, text, OUT host text, OUT port integer, OUT status text, OUT weight float4, OUT role text, OUT replication_delay bigint, OUT last_status_change timestamp) 10 | RETURNS record 11 | AS 'MODULE_PATHNAME', '_pcp_node_info' 12 | LANGUAGE C VOLATILE STRICT; 13 | -------------------------------------------------------------------------------- /src/sql/pgpool_adm/pgpool_adm--1.1--1.2.sql: -------------------------------------------------------------------------------- 1 | /* contrib/pgpool_adm/pgpool_adm--1.1--1.2.sql */ 2 | 3 | -- complain if script is sourced in psql, rather than via ALTER EXTENSION 4 | \echo Use "ALTER EXTENSION pgpool_adm UPDATE TO '1.1'" to load this file. \quit 5 | 6 | CREATE FUNCTION pcp_health_check_stats(integer, text, integer, text, text, OUT host text, OUT port integer, OUT status text, OUT role text, OUT last_status_change timestamp, OUT total_count bigint, OUT fail_count bigint, OUT skip_count bigint, OUT retry_count bigint, OUT average_retry_count float4, OUT max_retry_count bigint, OUT max_health_check_duration bigint, OUT min_health_check_duration bigint, OUT average_health_check_duration float4, OUT last_health_check timestamp, OUT last_successful_health_check timestamp, OUT last_skip_health_check timestamp, OUT last_failed_health_check timestamp); 7 | RETURNS record 8 | AS 'MODULE_PATHNAME', '_pcp_health_check_stats' 9 | LANGUAGE C VOLATILE STRICT; 10 | -------------------------------------------------------------------------------- /src/sql/pgpool_adm/pgpool_adm.control: -------------------------------------------------------------------------------- 1 | # pcp extension 2 | comment = 'Administrative functions for pgPool' 3 | default_version = '1.5' 4 | module_pathname = '$libdir/pgpool_adm' 5 | relocatable = true 6 | -------------------------------------------------------------------------------- /src/sql/pgpool_adm/pgpool_adm.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * pgpool_adm.h 4 | * 5 | * 6 | * Copyright (c) 2002-2018, PostgreSQL Global Development Group 7 | * 8 | * Author: Jehan-Guillaume (ioguix) de Rorthais 9 | * 10 | * IDENTIFICATION 11 | * contrib/pgpool_adm/pgpool_adm.h 12 | * 13 | *------------------------------------------------------------------------- 14 | */ 15 | 16 | #ifndef PGPOOL_ADM_H 17 | #define PGPOOL_ADM_H 18 | 19 | PG_MODULE_MAGIC; 20 | 21 | 22 | Datum _pcp_node_info(PG_FUNCTION_ARGS); 23 | Datum _pcp_health_check_stats(PG_FUNCTION_ARGS); 24 | Datum _pcp_pool_status(PG_FUNCTION_ARGS); 25 | Datum _pcp_node_count(PG_FUNCTION_ARGS); 26 | Datum _pcp_attach_node(PG_FUNCTION_ARGS); 27 | Datum _pcp_detach_node(PG_FUNCTION_ARGS); 28 | 29 | PG_FUNCTION_INFO_V1(_pcp_node_info); 30 | PG_FUNCTION_INFO_V1(_pcp_health_check_stats); 31 | PG_FUNCTION_INFO_V1(_pcp_pool_status); 32 | PG_FUNCTION_INFO_V1(_pcp_node_count); 33 | PG_FUNCTION_INFO_V1(_pcp_attach_node); 34 | PG_FUNCTION_INFO_V1(_pcp_detach_node); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/streaming_replication/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/test/.gitignore: -------------------------------------------------------------------------------- 1 | pgpool_setup 2 | watchdog_setup 3 | testdir/ 4 | -------------------------------------------------------------------------------- /src/test/C/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for example programs 3 | # 4 | 5 | subdir = . 6 | top_builddir = /usr/local/src/pgsql/current/pgsql 7 | include $(top_builddir)/src/Makefile.global 8 | 9 | ifeq ($(PORTNAME), win32) 10 | LDLIBS += -lws2_32 11 | endif 12 | 13 | override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) 14 | override LDLIBS := $(libpq_pgport) $(LDLIBS) 15 | 16 | 17 | PROGS = test_extended 18 | 19 | all: $(PROGS) 20 | 21 | clean: 22 | rm -f $(PROGS) 23 | -------------------------------------------------------------------------------- /src/test/extended-query-test/.gitignore: -------------------------------------------------------------------------------- 1 | regression.log 2 | temp/ 3 | results/ 4 | testdata/ 5 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/aborted-transaction.data: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="S1", query="BEGIN") 2 | FE=> Bind(stmt="S1", portal="") 3 | FE=> Execute(portal="") 4 | FE=> Close(stmt="S1") 5 | FE=> Parse(stmt="S1", query="aaa") 6 | FE=> Bind(stmt="S1", portal="") 7 | FE=> Execute(portal="") 8 | FE=> Close(stmt="S1") 9 | FE=> Sync 10 | <= BE ParseComplete 11 | <= BE BindComplete 12 | <= BE CommandComplete(BEGIN) 13 | <= BE CloseComplete 14 | <= BE ErrorResponse(S ERROR V ERROR C 42601 M syntax error at or near "aaa" P 1 F scan.l L 1087 R scanner_yyerror ) 15 | <= BE ReadyForQuery(E) 16 | FE=> Terminate 17 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/bug370-sql-error-followed-by-select.data: -------------------------------------------------------------------------------- 1 | FE=> Query (query="SET statement_timeout = '4s'") 2 | <= BE CommandComplete(SET) 3 | <= BE ReadyForQuery(I) 4 | FE=> Parse(stmt="S1", query="SELECT 1/0") 5 | FE=> Bind(stmt="S1", portal="") 6 | FE=> Execute(portal="") 7 | FE=> Close(stmt="S1") 8 | FE=> Parse(stmt="S2", query="SELECT * from pg_tables") 9 | FE=> Bind(stmt="S2", portal="") 10 | FE=> Execute(portal="") 11 | FE=> Close(stmt="S2") 12 | FE=> Sync 13 | <= BE ParseComplete 14 | <= BE ErrorResponse(S ERROR V ERROR C 22012 M division by zero F int.c L 704 R int4div ) 15 | <= BE ReadyForQuery(I) 16 | FE=> Terminate 17 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/flush.data: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="", query="SELECT 1") 2 | FE=> Flush 3 | <= BE ParseComplete 4 | FE=> Bind(stmt="", portal="") 5 | FE=> Flush 6 | <= BE BindComplete 7 | FE=> Execute(portal="") 8 | FE=> Flush 9 | FE=> Sync 10 | <= BE DataRow 11 | <= BE CommandComplete(SELECT 1) 12 | <= BE ReadyForQuery(I) 13 | FE=> Terminate 14 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/node_js.data: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="", query="SELECT 1") 2 | FE=> Bind(stmt="", portal="") 3 | FE=> Execute(portal="") 4 | FE=> Flush 5 | <= BE ParseComplete 6 | <= BE BindComplete 7 | <= BE DataRow 8 | <= BE CommandComplete(SELECT 1) 9 | FE=> Sync 10 | <= BE ReadyForQuery(I) 11 | FE=> Terminate 12 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/select-multi-rows.data: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="S1", query="BEGIN") 2 | FE=> Bind(stmt="S1", portal="") 3 | FE=> Execute(portal="") 4 | FE=> Close(stmt="S1") 5 | FE=> Parse(stmt="S2", query="SELECT * FROM generate_series(1,10)") 6 | FE=> Bind(stmt="S2", portal="") 7 | FE=> Describe(stmt="S2") 8 | FE=> Execute(portal="") 9 | FE=> Close(stmt="S2") 10 | FE=> Parse(stmt="S1", query="COMMIT") 11 | FE=> Bind(stmt="S1", portal="") 12 | FE=> Execute(portal="") 13 | FE=> Close(stmt="S1") 14 | FE=> Sync 15 | <= BE ParseComplete 16 | <= BE BindComplete 17 | <= BE CommandComplete(BEGIN) 18 | <= BE CloseComplete 19 | <= BE ParseComplete 20 | <= BE BindComplete 21 | <= BE ParameterDescription 22 | <= BE RowDescription 23 | <= BE DataRow 24 | <= BE DataRow 25 | <= BE DataRow 26 | <= BE DataRow 27 | <= BE DataRow 28 | <= BE DataRow 29 | <= BE DataRow 30 | <= BE DataRow 31 | <= BE DataRow 32 | <= BE DataRow 33 | <= BE CommandComplete(SELECT 10) 34 | <= BE CloseComplete 35 | <= BE ParseComplete 36 | <= BE BindComplete 37 | <= BE CommandComplete(COMMIT) 38 | <= BE CloseComplete 39 | <= BE ReadyForQuery(I) 40 | FE=> Terminate 41 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/sql-error.data: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="S1", query="BEGIN") 2 | FE=> Bind(stmt="S1", portal="") 3 | FE=> Execute(portal="") 4 | FE=> Close(stmt="S1") 5 | FE=> Parse(stmt="S2", query="SELECT * FROM non_existsing_table") 6 | FE=> Bind(stmt="S2", portal="") 7 | FE=> Execute(portal="") 8 | FE=> Close(stmt="S2") 9 | FE=> Parse(stmt="S1", query="COMMIT") 10 | FE=> Bind(stmt="S1", portal="") 11 | FE=> Execute(portal="") 12 | FE=> Close(stmt="S1") 13 | FE=> Sync 14 | <= BE ParseComplete 15 | <= BE BindComplete 16 | <= BE CommandComplete(BEGIN) 17 | <= BE CloseComplete 18 | <= BE ErrorResponse(S ERROR V ERROR C 42P01 M relation "non_existsing_table" does not exist P 15 F parse_relation.c L 1180 R parserOpenTable ) 19 | <= BE ReadyForQuery(E) 20 | FE=> Terminate 21 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/statement_level_load_balance.data: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="S0", query="BEGIN") 2 | FE=> Bind(stmt="S0", portal="") 3 | FE=> Execute(portal="") 4 | FE=> Close(stmt="S0") 5 | FE=> Parse(stmt="S1", query="SELECT 1") 6 | FE=> Bind(stmt="S1", portal="") 7 | FE=> Execute(portal="") 8 | FE=> Close(stmt="S1") 9 | FE=> Parse(stmt="S2", query="SELECT 2") 10 | FE=> Bind(stmt="S2", portal="") 11 | FE=> Execute(portal="") 12 | FE=> Close(stmt="S2") 13 | FE=> Parse(stmt="S3", query="COMMIT") 14 | FE=> Bind(stmt="S3", portal="") 15 | FE=> Execute(portal="") 16 | FE=> Close(stmt="S3") 17 | FE=> Sync 18 | <= BE ParseComplete 19 | <= BE BindComplete 20 | <= BE CommandComplete(BEGIN) 21 | <= BE CloseComplete 22 | <= BE ParseComplete 23 | <= BE BindComplete 24 | <= BE DataRow 25 | <= BE CommandComplete(SELECT 1) 26 | <= BE CloseComplete 27 | <= BE ParseComplete 28 | <= BE BindComplete 29 | <= BE DataRow 30 | <= BE CommandComplete(SELECT 1) 31 | <= BE CloseComplete 32 | <= BE ParseComplete 33 | <= BE BindComplete 34 | <= BE CommandComplete(COMMIT) 35 | <= BE CloseComplete 36 | <= BE ReadyForQuery(I) 37 | FE=> Terminate 38 | -------------------------------------------------------------------------------- /src/test/extended-query-test/expected/unable_to_bind.data: -------------------------------------------------------------------------------- 1 | FE=> Query (query="DROP TABLE IF EXISTS pgproto_test1") 2 | <= BE NoticeResponse(S NOTICE V NOTICE C 00000 M table "pgproto_test1" does not exist, skipping F tablecmds.c L 914 R DropErrorMsgNonExistent ) 3 | <= BE CommandComplete(DROP TABLE) 4 | <= BE ReadyForQuery(I) 5 | FE=> Query (query="CREATE TABLE pgproto_test1(i INT)") 6 | <= BE CommandComplete(CREATE TABLE) 7 | <= BE ReadyForQuery(I) 8 | FE=> Parse(stmt="", query="BEGIN") 9 | FE=> Bind(stmt="S1", portal="") 10 | FE=> Execute(portal="") 11 | FE=> Parse(stmt="", query="INSERT INTO pgproto_test1 VALUES(1)") 12 | FE=> Bind(stmt="", portal="") 13 | FE=> Execute(portal="") 14 | FE=> Parse(stmt="", query="COMMIT") 15 | FE=> Bind(stmt="", portal="") 16 | FE=> Execute(portal="") 17 | FE=> Sync 18 | <= BE ErrorResponse(S FATAL C XX000 M unable to bind D cannot get parse message "S1" F pool_proto_modules.c L 1324 ) 19 | read_it: read(2) returns error Connection reset by peer 20 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-always-black-function.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Create: 0 Parse: 1 Parse: 0 Execute: 0 Parse: 0 Execute: 0 4 | # Parse: 0 Execute: 0 Parse: 0 Execute: 0 Parse: 0 Execute: 0 5 | set 0 0 0 0 0 0 0 0 0 0 0 0 6 | 7 | grep "SELECT" $PGPOOLLOG | grep -v version|awk '{print $9}' | while read node 8 | do 9 | if [ $1 -ne $node ] 10 | then 11 | echo "expected: $1 result: $node" 12 | exit 99 13 | fi 14 | shift 15 | done 16 | 17 | if [ $? = 99 ] 18 | then 19 | exit 1 20 | fi 21 | 22 | exit 0 23 | 24 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-always.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Parse: 1 Parse: 0 Execute: 0 Parse: 0 Execute: 0 4 | # Parse: 0 Execute: 0 Parse: 0 Execute: 0 Parse: 0 Execute: 0 5 | # SELECT: 0 SELECT: 0 SELECT: 0 SELECT: 0 6 | set 1 0 0 0 0 0 0 0 0 0 0 0 0 0 7 | 8 | grep "SELECT" $PGPOOLLOG | grep -v version |awk '{print $9}' | while read node 9 | do 10 | if [ $1 -ne $node ] 11 | then 12 | echo "expected: $1 result: $node" 13 | exit 99 14 | fi 15 | shift 16 | done 17 | 18 | if [ $? = 99 ] 19 | then 20 | exit 1 21 | fi 22 | 23 | exit 0 24 | 25 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-default-black-function.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Create: 0 Parse: 1 Parse: 0 Execute: 0 Parse: 0 Execute: 0 Parse: 0 Execute: 0 4 | # Parse: 1 Execute: 1 5 | # Execute: 0 Parse: 0 Execute: 0 6 | set 0 1 0 0 0 0 0 0 1 1 0 1 1 7 | 8 | grep "SELECT" $PGPOOLLOG | grep -v version |grep -v Bind|awk '{print $9}' | while read node 9 | do 10 | if [ $1 -ne $node ] 11 | then 12 | echo "expected: $1 result: $node" 13 | exit 99 14 | fi 15 | shift 16 | done 17 | 18 | if [ $? = 99 ] 19 | then 20 | exit 1 21 | fi 22 | 23 | exit 0 24 | 25 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-default-simple.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: SELECT: 1 SELECT: 0 SELECT: 1 SELECT: 1 4 | set 1 0 1 1 5 | 6 | grep "SELECT" $PGPOOLLOG | grep -v version |awk '{print $9}' | while read node 7 | do 8 | if [ $1 -ne $node ] 9 | then 10 | echo "expected: $1 result: $node" 11 | exit 99 12 | fi 13 | shift 14 | done 15 | 16 | if [ $? = 99 ] 17 | then 18 | exit 1 19 | fi 20 | 21 | exit 0 22 | 23 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-default.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Parse: 1 Parse: 0 Execute: 0 Parse: 0 Execute: 0 4 | # Parse: 1 Execute: 1 Parse: 1 Execute: 1 Parse: 1 Execute: 1 5 | set 1 0 0 0 0 1 1 0 1 1 6 | 7 | grep "SELECT" $PGPOOLLOG | grep -v version |grep -v Bind|awk '{print $9}' | while read node 8 | do 9 | if [ $1 -ne $node ] 10 | then 11 | echo "expected: $1 result: $node" 12 | exit 99 13 | fi 14 | shift 15 | done 16 | 17 | if [ $? = 99 ] 18 | then 19 | exit 1 20 | fi 21 | 22 | exit 0 23 | 24 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-off-black-function.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Create: 0 Parse: 1 Parse: 0 Execute: 0 Parse: 1 Execute: 1 Parse: 1 Execute: 1 4 | # Parse: 1 Execute: 1 5 | # Execute: 1 Parse: 1 Execute: 1 6 | set 0 1 0 0 1 1 1 1 1 1 1 1 1 7 | 8 | grep "SELECT" $PGPOOLLOG | grep -v version |grep -v Bind|awk '{print $9}' | while read node 9 | do 10 | if [ $1 -ne $node ] 11 | then 12 | echo "expected: $1 result: $node" 13 | exit 99 14 | fi 15 | shift 16 | done 17 | 18 | if [ $? = 99 ] 19 | then 20 | exit 1 21 | fi 22 | 23 | exit 0 24 | 25 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-off.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Parse: 1 Parse: 1 Execute: 1 Parse: 1 Execute: 1 4 | # Parse: 1 Execute: 1 Parse: 1 Execute: 1 Parse: 1 Execute: 1 5 | # SELECT: 1 SELECT: 1 SELECT: 1 SELECT: 1 6 | set 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 | 8 | grep "SELECT" $PGPOOLLOG | grep -v version |awk '{print $9}' | while read node 9 | do 10 | if [ $1 -ne $node ] 11 | then 12 | echo "expected: $1 result: $node" 13 | exit 99 14 | fi 15 | shift 16 | done 17 | 18 | if [ $? = 99 ] 19 | then 20 | exit 1 21 | fi 22 | 23 | exit 0 24 | 25 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-simple-black-function.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: CREATE: 0 SELECT: 1 SELECT: 0 SELECT: 0 SELECT: 1 SELECT: 1 4 | set 0 1 0 0 1 1 5 | 6 | grep "SELECT" $PGPOOLLOG | grep -v version |awk '{print $9}' | while read node 7 | do 8 | if [ $1 -ne $node ] 9 | then 10 | echo "expected: $1 result: $node" 11 | exit 99 12 | fi 13 | shift 14 | done 15 | 16 | if [ $? = 99 ] 17 | then 18 | exit 1 19 | fi 20 | 21 | exit 0 22 | 23 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-simple.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: SELECT: 1 SELECT: 0 SELECT: 1 SELECT: 0 4 | set 1 0 1 0 5 | 6 | grep "SELECT" $PGPOOLLOG | grep -v version |awk '{print $9}' | while read node 7 | do 8 | if [ $1 -ne $node ] 9 | then 10 | echo "expected: $1 result: $node" 11 | exit 99 12 | fi 13 | shift 14 | done 15 | 16 | if [ $? = 99 ] 17 | then 18 | exit 1 19 | fi 20 | 21 | exit 0 22 | 23 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-trans-black-function.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Create: 0 Parse: 1 Parse: 0 Execute: 0 Parse: 0 Execute: 0 Parse: 0 Execute: 0 4 | # Parse: 1 Execute: 1 5 | # Execute: 0 Parse: 0 Execute: 0 6 | set 0 1 0 0 0 0 0 0 1 1 0 0 0 7 | 8 | grep "SELECT" $PGPOOLLOG | grep -v version |grep -v Bind|awk '{print $9}' | while read node 9 | do 10 | if [ $1 -ne $node ] 11 | then 12 | echo "expected: $1 result: $node" 13 | exit 99 14 | fi 15 | shift 16 | done 17 | 18 | if [ $? = 99 ] 19 | then 20 | exit 1 21 | fi 22 | 23 | exit 0 24 | 25 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance-white-function.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Create: 0 Parse: 1 parse: 1 Execute: 1 Parse: 1 Execute: 1 Parse: 1 Execute: 1 4 | # Parse: 1 Execute: 1 5 | # Parse: 1 Execute: 1 Parse: 1 Execute: 1 6 | set 0 1 1 1 1 1 1 1 1 1 1 1 1 1 7 | 8 | grep "SELECT" $PGPOOLLOG | grep -v version | grep -v pg_sleep | awk '{print $9}' | while read node 9 | do 10 | if [ $1 -ne $node ] 11 | then 12 | echo "expected: $1 result: $node" 13 | exit 99 14 | fi 15 | shift 16 | done 17 | 18 | if [ $? = 99 ] 19 | then 20 | exit 1 21 | fi 22 | 23 | exit 0 24 | 25 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/disable-load-balance.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Parse: 1 Parse: 0 Execute: 0 Parse: 0 Execute: 0 4 | # Parse: 1 Execute: 1 Parse: 0 Execute: 0 Parse: 0 Execute: 0 5 | set 1 0 0 0 0 1 1 0 0 0 0 6 | 7 | grep "SELECT" $PGPOOLLOG | grep -v version |grep -v Bind| awk '{print $9}' | while read node 8 | do 9 | if [ $1 -ne $node ] 10 | then 11 | echo "expected: $1 result: $node" 12 | exit 99 13 | fi 14 | shift 15 | done 16 | 17 | if [ $? = 99 ] 18 | then 19 | exit 1 20 | fi 21 | 22 | exit 0 23 | 24 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/parse-before-bind-2.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set 1 0 0 # expected results: Parse:1 Parse:0 Execute: 0 4 | grep "SELECT 1" $PGPOOLLOG |awk '{print $9}' | while read node 5 | do 6 | if [ $1 -ne $node ] 7 | then 8 | echo "expected: $1 result: $node" 9 | exit 99 10 | fi 11 | shift 12 | done 13 | 14 | if [ $? = 99 ] 15 | then 16 | exit 1 17 | fi 18 | 19 | exit 0 20 | 21 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/parse-before-bind.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set 1 0 0 # expected results: Parse:1 Parse:0 Execute: 0 4 | grep "SELECT 1" $PGPOOLLOG |awk '{print $9}' | while read node 5 | do 6 | if [ $1 -ne $node ] 7 | then 8 | echo "expected: $1 result: $node" 9 | exit 99 10 | fi 11 | shift 12 | done 13 | 14 | if [ $? = 99 ] 15 | then 16 | exit 1 17 | fi 18 | 19 | exit 0 20 | 21 | -------------------------------------------------------------------------------- /src/test/extended-query-test/extra_scripts/statement_level_load_balance.data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # expected results: Parse: 0 Parse: 1 Parse: 2 Execute:0 Execute:1 Execute:2 4 | set 0 1 2 0 1 2 5 | grep "BEGIN" $PGPOOLLOG | grep "LOG" | awk '{print $9}' | while read node 6 | do 7 | if [ $1 -ne $node ]; then 8 | echo "expected: $1 result: $node" 9 | exit 99 10 | fi 11 | shift 12 | done 13 | 14 | if [ $? = 99 ]; then 15 | exit 1 16 | fi 17 | 18 | # expected results: Parse: 0 Parse: 1 Parse: 2 Execute:0 Execute:1 Execute:2 19 | set 0 1 2 0 1 2 20 | grep "COMMIT" $PGPOOLLOG | grep "LOG" | awk '{print $9}' | while read node 21 | do 22 | if [ $1 -ne $node ]; then 23 | echo "expected: $1 result: $node" 24 | exit 99 25 | fi 26 | shift 27 | done 28 | 29 | if [ $? = 99 ]; then 30 | exit 1 31 | fi 32 | 33 | # select load balance node per query 34 | n=`grep "selecting load balance node" $PGPOOLLOG | wc -l` 35 | if [ $n != 5 ]; then 36 | exit 1 37 | fi 38 | 39 | exit 0 40 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/aborted-transaction.data: -------------------------------------------------------------------------------- 1 | # Aborted transaction case. 2 | # 3 | 4 | # Start a transaction 5 | 'P' "S1" "BEGIN" 0 6 | 'B' "" "S1" 0 0 0 7 | 'E' "" 0 8 | 'C' 'S' "S1" 9 | 10 | # Issue an error command 11 | 'P' "S1" "aaa" 0 12 | 'B' "" "S1" 0 0 0 13 | 'E' "" 0 14 | 'C' 'S' "S1" 15 | 'S' 16 | 'Y' 17 | 'X' 18 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/bug370-sql-error-followed-by-select.data: -------------------------------------------------------------------------------- 1 | # Test data for 0000370: 2 | # SQL error followed by normal SELECT gets stuck. 3 | 4 | # Test data for 0000370: 5 | # SQL error followed by normal SELECT gets stuck. 6 | 7 | 'Q' "SET statement_timeout = '4s'" 8 | 9 | # Receive response from backend 10 | 'Y' 11 | 12 | 'P' "S1" "SELECT 1/0" 0 13 | 'B' "" "S1" 0 0 0 14 | 'E' "" 0 15 | 'C' 'S' "S1" 16 | 17 | 'P' "S2" "SELECT * from pg_tables" 0 18 | 'B' "" "S2" 0 0 0 19 | 'E' "" 0 20 | 'C' 'S' "S2" 21 | 22 | # Issue Sync message 23 | 'S' 24 | 25 | # Receive response from backend 26 | 'Y' 27 | # Send terminate message 28 | 'X' 29 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/flush.data: -------------------------------------------------------------------------------- 1 | # [pgpool-general: 7967] Hang with Skunk because Flush not honoured 2 | # 3 | 'P' "" "SELECT 1" 0 4 | 'H' 5 | 'z' 6 | 'B' "" "" 0 0 0 7 | 'H' 8 | 'z' 9 | 'E' "" 0 10 | 'H' 11 | 'S' 12 | 'Y' 13 | 'X' 14 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/node_js.data: -------------------------------------------------------------------------------- 1 | # Test data for 0000345: pgpool node.js prepared statement The purpose 2 | # for this test is 'y' after 'H' (frontend wants response of H 3 | # message). 4 | 5 | # Issue SELECT 6 | 'P' "" "SELECT 1" 0 7 | 'B' "" "" 0 0 0 8 | 'E' "" 0 9 | 'H' 10 | 'y' 11 | 'S' 12 | 'Y' 13 | 'X' 14 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/parse-before-bind.data: -------------------------------------------------------------------------------- 1 | # Test data for bug271. 2 | # In an explicit transaction, SELECT is parsed, DML issued, same SELECT/bind issued. 3 | # In this case Pgpool-II should parse resend to primary node. 4 | # Also weight must 0 for primary and 1 for standby. 5 | # 6 | 7 | ##backend_weight0 = 0 8 | ##backend_weight1 = 1 9 | 10 | # Create test table 11 | 'Q' "DROP TABLE IF EXISTS pgproto_test1" 12 | 'Y' 13 | 'Q' "CREATE TABLE pgproto_test1(i INT)" 14 | 'Y' 15 | 16 | # Start a transaction 17 | 'P' "S1" "BEGIN" 0 18 | 'B' "" "S1" 0 0 0 19 | 'E' "" 0 20 | 'C' 'S' "S1" 21 | 22 | # Issue SELECT 23 | 'P' "S2" "SELECT 1" 0 24 | 25 | # Issue INSERT 26 | 'P' "S1" "INSERT INTO pgproto_test1 VALUES(1)" 0 27 | 'B' "" "S1" 0 0 0 28 | 'E' "" 0 29 | 'C' 'S' "S1" 30 | 31 | # Issue SELECT. This should be sent to primary node. 32 | 'B' "" "S2" 0 0 0 33 | 'E' "" 0 34 | 'C' 'S' "S2" 35 | 36 | # Issue COMMIT 37 | 'P' "S1" "COMMIT" 0 38 | 'B' "" "S1" 0 0 0 39 | 'E' "" 0 40 | 'C' 'S' "S1" 41 | 'S' 42 | 'Y' 43 | 44 | # DROP test table 45 | 'Q' "DROP TABLE pgproto_test1" 46 | 'Y' 47 | 48 | 'X' 49 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/query-cache-notrans.data: -------------------------------------------------------------------------------- 1 | # query cache test without transaction 2 | # 3 | ##memory_cache_enabled = on 4 | 5 | # Create test table 6 | 'Q' "DROP TABLE IF EXISTS pgproto_test1" 7 | 'Y' 8 | 'Q' "CREATE TABLE pgproto_test1(i INT)" 9 | 'Y' 10 | 'Q' "INSERT INTO pgproto_test1 VALUES(1)" 11 | 'Y' 12 | 13 | # Issue SELECT 14 | 'P' "S2" "SELECT 1 FROM pgproto_test1" 0 15 | 'B' "" "S2" 0 0 0 16 | 'D' 'S' "S2" 17 | 'E' "" 0 18 | 'C' 'S' "S2" 19 | 20 | # Issue SELECT 21 | 'P' "S3" "SELECT 1 FROM pgproto_test1" 0 22 | 'B' "" "S3" 0 0 0 23 | 'D' 'S' "S3" 24 | 'E' "" 0 25 | 'C' 'S' "S3" 26 | 27 | 'S' 28 | 'Y' 29 | 30 | # DROP test table 31 | 'Q' "DROP TABLE pgproto_test1" 32 | 'Y' 33 | 34 | 'X' 35 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/query-cache.data: -------------------------------------------------------------------------------- 1 | # query cache test 2 | # 3 | 4 | ##memory_cache_enabled = on 5 | 6 | # Create test table 7 | 'Q' "DROP TABLE IF EXISTS pgproto_test1" 8 | 'Y' 9 | 'Q' "CREATE TABLE pgproto_test1(i INT)" 10 | 'Y' 11 | 'Q' "INSERT INTO pgproto_test1 VALUES(1)" 12 | 'Y' 13 | 14 | 'Q' "SELECT * FROM pgproto_test1" 15 | 'Y' 16 | 'Q' "SELECT * FROM pgproto_test1" 17 | 'Y' 18 | 19 | # Start a transaction 20 | 'P' "S1" "BEGIN" 0 21 | 'B' "" "S1" 0 0 0 22 | 'E' "" 0 23 | 'C' 'S' "S1" 24 | 25 | # Issue SELECT 26 | 'P' "S2" "SELECT 1 FROM pgproto_test1" 0 27 | 'B' "" "S2" 0 0 0 28 | 'E' "" 0 29 | 'C' 'S' "S2" 30 | 31 | # Issue COMMIT 32 | 'P' "S4" "COMMIT" 0 33 | 'B' "" "S4" 0 0 0 34 | 'E' "" 0 35 | 'C' 'S' "S4" 36 | 37 | 'S' 38 | 'Y' 39 | 40 | # Issue SELECT 41 | 'P' "S3" "SELECT 1 FROM pgproto_test1" 0 42 | 'B' "" "S3" 0 0 0 43 | 'E' "" 0 44 | 'C' 'S' "S3" 45 | 46 | 'S' 47 | 'Y' 48 | 49 | # DROP test table 50 | 'Q' "DROP TABLE pgproto_test1" 51 | 'Y' 52 | 53 | 'X' 54 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/select-multi-rows.data: -------------------------------------------------------------------------------- 1 | # Simple SELECT test for extracting muliple rows. 2 | 3 | # Start a transaction 4 | 'P' "S1" "BEGIN" 0 5 | 'B' "" "S1" 0 0 0 6 | 'E' "" 0 7 | 'C' 'S' "S1" 8 | 9 | # Issue SELECT 10 | 'P' "S2" "SELECT * FROM generate_series(1,10)" 0 11 | 'B' "" "S2" 0 0 0 12 | 'D' 'S' "S2" 13 | 'E' "" 0 14 | 'C' 'S' "S2" 15 | 16 | # Issue COMMIT 17 | 'P' "S1" "COMMIT" 0 18 | 'B' "" "S1" 0 0 0 19 | 'E' "" 0 20 | 'C' 'S' "S1" 21 | 'S' 22 | 'Y' 23 | 'X' 24 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/sql-error.data: -------------------------------------------------------------------------------- 1 | # Test data for error case. 2 | # 3 | 4 | # Start a transaction 5 | 'P' "S1" "BEGIN" 0 6 | 'B' "" "S1" 0 0 0 7 | 'E' "" 0 8 | 'C' 'S' "S1" 9 | 10 | # Issue SELECT 11 | 'P' "S2" "SELECT * FROM non_existsing_table" 0 12 | 'B' "" "S2" 0 0 0 13 | 'E' "" 0 14 | 'C' 'S' "S2" 15 | 16 | # Issue COMMIT 17 | 'P' "S1" "COMMIT" 0 18 | 'B' "" "S1" 0 0 0 19 | 'E' "" 0 20 | 'C' 'S' "S1" 21 | 'S' 22 | 'Y' 23 | 'X' 24 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests/unable_to_bind.data: -------------------------------------------------------------------------------- 1 | # Test data for FATAL: unable to bind DETAIL: cannot get parse message 2 | # "S1". This caused hang up of Pgpool-II. 3 | 4 | ##backend_weight0 = 1 5 | ##backend_weight1 = 0 6 | 7 | # Create test table 8 | 'Q' "DROP TABLE IF EXISTS pgproto_test1" 9 | 'Y' 10 | 'Q' "CREATE TABLE pgproto_test1(i INT)" 11 | 'Y' 12 | 13 | # Start a transaction 14 | 'P' "" "BEGIN" 0 15 | 'B' "" "S1" 0 0 0 16 | 'E' "" 0 17 | 18 | # Issue INSERT 19 | 'P' "" "INSERT INTO pgproto_test1 VALUES(1)" 0 20 | 'B' "" "" 0 0 0 21 | 'E' "" 0 22 | 23 | # Issue COMMIT 24 | 'P' "" "COMMIT" 0 25 | 'B' "" "" 0 0 0 26 | 'E' "" 0 27 | 'S' 28 | 'Y' 29 | 30 | # DROP test table 31 | 'Q' "DROP TABLE pgproto_test1" 32 | 'Y' 33 | 34 | 'X' 35 | -------------------------------------------------------------------------------- /src/test/extended-query-test/tests_n3/statement_level_load_balance.data: -------------------------------------------------------------------------------- 1 | # Test statement_level_load_balance = on 2 | 3 | ##statement_level_load_balance = on 4 | ##log_min_messages = debug1 5 | 6 | 'P' "S0" "BEGIN" 0 7 | 'B' "" "S0" 0 0 0 8 | 'E' "" 0 9 | 'C' 'S' "S0" 10 | 11 | 'P' "S1" "SELECT 1" 0 12 | 'B' "" "S1" 0 0 0 13 | 'E' "" 0 14 | 'C' 'S' "S1" 15 | 16 | 'P' "S2" "SELECT 2" 0 17 | 'B' "" "S2" 0 0 0 18 | 'E' "" 0 19 | 'C' 'S' "S2" 20 | 21 | 'P' "S3" "COMMIT" 0 22 | 'B' "" "S3" 0 0 0 23 | 'E' "" 0 24 | 'C' 'S' "S3" 25 | 'S' 26 | 'Y' 27 | 'X' 28 | -------------------------------------------------------------------------------- /src/test/parser/.cvsignore: -------------------------------------------------------------------------------- 1 | gram.c 2 | parse.h 3 | parser-test 4 | scan.c 5 | test.diff 6 | result 7 | -------------------------------------------------------------------------------- /src/test/parser/README: -------------------------------------------------------------------------------- 1 | $Header$ 2 | 3 | 1. Parser test program 4 | 5 | 1.1 How to build 6 | Parser test program builds with the following command. 7 | 8 | % make 9 | 10 | "parser-test" file is created. 11 | 12 | 1.2 Running program 13 | You passes a SQL statement to parser-test. If the program accepts the 14 | statement, it outputs SQL generated from a parse tree. 15 | 16 | % ./parser-test "select 1" 17 | SELECT 1 18 | 19 | If the program does not accept, it outputs an error. 20 | 21 | % ./parser-test "aaa" 22 | syntax error: aaa 23 | 24 | 25 | 2. Testing 26 | 2.1 How to test 27 | You types the following command. 28 | 29 | % make test 30 | 31 | If test is failed, you should check test.diff. Then please send 32 | test.diff to developers. 33 | -------------------------------------------------------------------------------- /src/test/parser/expected/copy.out: -------------------------------------------------------------------------------- 1 | COPY "t" FROM 'xxx' 2 | COPY "t" FROM STDIN 3 | COPY "t"("x", "y") FROM 'xxx' 4 | COPY "t" FROM 'xxx' BINARY 5 | COPY "t" FROM 'xxx' CSV HEADER QUOTE '#' ESCAPE '$' FORCE NOT NULL "foo", "bar" 6 | COPY "t" FROM 'xxx' OIDS 7 | COPY "t" FROM 'xxx' DELIMITERS ',' 8 | COPY "t" FROM 'xxx' NULL 'x' 9 | COPY "t" TO 'yyy' 10 | COPY "t" TO STDOUT 11 | COPY "t"("x", "y") TO 'yyy' 12 | COPY "t" TO 'yyy' BINARY 13 | COPY "t" FROM 'xxx' CSV HEADER QUOTE '#' ESCAPE '$' FORCE QUOTE "foo", "bar" 14 | COPY "t" TO 'yyy' OIDS 15 | COPY "t" TO 'yyy' DELIMITERS ',' 16 | COPY "t" TO 'yyy' NULL 'x' 17 | COPY ( SELECT * FROM "t") TO 'xxx' 18 | -------------------------------------------------------------------------------- /src/test/parser/expected/cursor.out: -------------------------------------------------------------------------------- 1 | DECLARE "xx" CURSOR FOR SELECT * FROM "t" 2 | DECLARE "xx" BINARY CURSOR FOR SELECT * FROM "t" 3 | DECLARE "xx" INSENSITIVE CURSOR FOR SELECT * FROM "t" 4 | DECLARE "xx" SCROLL CURSOR FOR SELECT * FROM "t" 5 | DECLARE "xx" CURSOR WITH HOLD FOR SELECT * FROM "t" 6 | DECLARE "xx" CURSOR FOR SELECT * FROM "t" 7 | CLOSE "xx" 8 | FETCH FORWARD 1 IN "xx" 9 | FETCH FORWARD 1 IN "xx" 10 | FETCH BACKWARD 1 IN "xx" 11 | FETCH LAST IN "xx" 12 | FETCH ABSOLUTE 2 IN "xx" 13 | FETCH RELATIVE 2 IN "xx" 14 | FETCH FORWARD 1 IN "xx" 15 | FETCH FORWARD ALL IN "xx" 16 | FETCH FORWARD 1 IN "xx" 17 | FETCH FORWARD 2 IN "xx" 18 | FETCH FORWARD ALL IN "xx" 19 | FETCH BACKWARD 1 IN "xx" 20 | FETCH BACKWARD 3 IN "xx" 21 | FETCH BACKWARD ALL IN "xx" 22 | FETCH BACKWARD ALL IN "xx" 23 | MOVE FORWARD 1 IN "xx" 24 | MOVE FORWARD 1 IN "xx" 25 | MOVE BACKWARD 1 IN "xx" 26 | MOVE LAST IN "xx" 27 | MOVE ABSOLUTE 2 IN "xx" 28 | MOVE RELATIVE 2 IN "xx" 29 | MOVE FORWARD 1 IN "xx" 30 | MOVE FORWARD ALL IN "xx" 31 | MOVE FORWARD 1 IN "xx" 32 | MOVE FORWARD 2 IN "xx" 33 | MOVE FORWARD ALL IN "xx" 34 | MOVE BACKWARD 1 IN "xx" 35 | MOVE BACKWARD 3 IN "xx" 36 | MOVE BACKWARD ALL IN "xx" 37 | MOVE BACKWARD ALL IN "xx" 38 | -------------------------------------------------------------------------------- /src/test/parser/expected/delete.out: -------------------------------------------------------------------------------- 1 | DELETE FROM "t" 2 | syntax error: DELETE ; 3 | DELETE FROM "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 4 | DELETE FROM "t" WHERE ("x"=3 ) 5 | DELETE FROM "t" WHERE "x" IN ( SELECT * FROM "t1") 6 | DELETE FROM "foo" WHERE ("a"=1 ) RETURNING * 7 | DELETE FROM "foo" WHERE ("a"=1 ) RETURNING "a" 8 | DELETE FROM "foo" WHERE ("a"=1 ) RETURNING "a","b" 9 | syntax error: DELETE FROM foo WHERE CURRENT OF $1 10 | DELETE FROM "foo" WHERE CURRENT OF cur 11 | -------------------------------------------------------------------------------- /src/test/parser/expected/drop.out: -------------------------------------------------------------------------------- 1 | DROP TABLE "foo" 2 | DROP OWNED BY "role_a" 3 | DROP OWNED BY "role_a" CASCADE 4 | DROP OWNED BY "role_a" 5 | DROP OWNED BY "role_a", "role_b", "role_c" 6 | REASSIGN OWNED BY "role_a" TO "role_b" 7 | REASSIGN OWNED BY "role_a", "role1" TO "role_b" 8 | DROP OPERATOR FAMILY "foo" USING "bar" 9 | DROP OPERATOR FAMILY IF EXISTS "foo" USING "bar" 10 | syntax error: DROP OPERATOR FAMILY foo USING 11 | DROP ROLE "foo" 12 | DROP ROLE IF EXISTS "foo" 13 | -------------------------------------------------------------------------------- /src/test/parser/expected/insert.out: -------------------------------------------------------------------------------- 1 | INSERT INTO "t" VALUES (1) 2 | INSERT INTO "t"("a") VALUES (2) 3 | INSERT INTO "t"("a", "b", "c") VALUES (2,2) 4 | INSERT INTO "t"("a", "b", "c") VALUES (2,2,3) 5 | INSERT INTO "t"("a", "b", "c") VALUES (2,DEFAULT,'3') 6 | INSERT INTO "t" DEFAULT VALUES 7 | INSERT INTO "t" SELECT * FROM "t" 8 | INSERT INTO "t" VALUES ("func"("x","y")) 9 | INSERT INTO "t"("a", "b", "c") VALUES (2,DEFAULT,'''\\') 10 | INSERT INTO "foo"("a", "b") VALUES (1,2) RETURNING * 11 | INSERT INTO "foo"("a", "b") VALUES (1,2) RETURNING "a" 12 | INSERT INTO "foo"("a", "b") VALUES (1,2) RETURNING "a","b" 13 | INSERT INTO "foo"("a", "b") VALUES (1,2), (3,4), (5,6) 14 | -------------------------------------------------------------------------------- /src/test/parser/expected/misc.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | EXPLAIN SELECT * FROM "t" 12 | EXPLAIN ANALYZE SELECT * FROM "t" 13 | EXPLAIN ANALYZE VERBOSE SELECT * FROM "t" 14 | REINDEX INDEX "x" 15 | REINDEX INDEX "x" 16 | REINDEX TABLE "x" 17 | REINDEX TABLE "x" 18 | REINDEX DATABASE "x" 19 | REINDEX DATABASE "x" 20 | REINDEX SYSTEM "x" 21 | REINDEX SYSTEM "x" 22 | LISTEN "x" 23 | NOTIFY "x" 24 | DISCARD ALL 25 | DISCARD TEMP 26 | DISCARD TEMP 27 | DISCARD PLANS 28 | syntax error: DISCARD xxx 29 | -------------------------------------------------------------------------------- /src/test/parser/expected/prepare.out: -------------------------------------------------------------------------------- 1 | PREPARE "xx" (int4,"text") AS INSERT INTO "foo" VALUES ($1,$2) 2 | EXECUTE "xx" (1,'xxx') 3 | DEALLOCATE "xx" 4 | DEALLOCATE "xx" 5 | -------------------------------------------------------------------------------- /src/test/parser/expected/scanner.out: -------------------------------------------------------------------------------- 1 | pset 0 2 | SELECT '''' 3 | SELECT '''' 4 | SELECT 'A 5 | BC' 6 | SELECT 'A 7 | BC' 8 | syntax error: SELECT U&'d\0061t\+000061'; --error 9 | pset 1 10 | syntax error: SELECT '\''; -- error 11 | SELECT '''' 12 | SELECT 'A\\nBC' 13 | SELECT 'A 14 | BC' 15 | pset 0 16 | SELECT * FROM "data" 17 | SELECT 'data' 18 | SELECT 'data' 19 | SELECT 'data' 20 | syntax error: SELECT E'\u3042\u3044\u3046\u3048\u304a'; -- error 21 | syntax error: SELECT U&'\3042\3044\3046\3048\304a'; -- error 22 | pset 6 23 | SELECT * FROM "data" 24 | SELECT 'data' 25 | SELECT 'data' 26 | SELECT 'data' 27 | SELECT 'あいうえお' 28 | SELECT 'あいうえお' 29 | SELECT '𐀀' 30 | SELECT '𐀀' 31 | -------------------------------------------------------------------------------- /src/test/parser/expected/transaction.out: -------------------------------------------------------------------------------- 1 | BEGIN 2 | BEGIN 3 | BEGIN 4 | BEGIN ISOLATION LEVEL read committed 5 | BEGIN ISOLATION LEVEL serializable 6 | BEGIN READ WRITE 7 | BEGIN READ ONLY 8 | START TRANSACTION 9 | COMMIT 10 | COMMIT 11 | COMMIT 12 | COMMIT 13 | COMMIT 14 | COMMIT 15 | ABORT 16 | ABORT 17 | ABORT 18 | ABORT 19 | ABORT 20 | ABORT 21 | SET TRANSACTION ISOLATION LEVEL read committed 22 | SET TRANSACTION ISOLATION LEVEL serializable 23 | SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL read committed 24 | SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL serializable 25 | SET CONSTRAINTS ALL DEFERRED 26 | SET CONSTRAINTS ALL IMMEDIATE 27 | SET CONSTRAINTS "x" DEFERRED 28 | SET CONSTRAINTS "x" IMMEDIATE 29 | LOCK TABLE "t1","t2" IN ACCESS EXCLUSIVE MODE 30 | LOCK TABLE "t1","t2" IN ACCESS EXCLUSIVE MODE 31 | LOCK TABLE "t1","t2" IN ACCESS SHARE MODE 32 | LOCK TABLE "t1","t2" IN ROW SHARE MODE 33 | LOCK TABLE "t1","t2" IN ROW EXCLUSIVE MODE 34 | LOCK TABLE "t1","t2" IN SHARE UPDATE EXCLUSIVE MODE 35 | LOCK TABLE "t1","t2" IN SHARE MODE 36 | LOCK TABLE "t1","t2" IN SHARE ROW EXCLUSIVE MODE 37 | LOCK TABLE "t1","t2" IN EXCLUSIVE MODE 38 | LOCK TABLE "t1","t2" IN ACCESS EXCLUSIVE MODE 39 | -------------------------------------------------------------------------------- /src/test/parser/expected/update.out: -------------------------------------------------------------------------------- 1 | UPDATE "t" SET "a" = 1 2 | UPDATE "t" SET "a" = 3, "b" = 'a', "c" = NULL, "d" = DEFAULT 3 | UPDATE "t" SET "a" = 1 FROM "x" 4 | UPDATE "t" SET "a" = 1 FROM "x","y","z" 5 | UPDATE "t" SET "a" = 1 FROM "x" WHERE ( ("x"<100 ) AND ("y">200 )) 6 | UPDATE "t" SET "a" = 1 7 | UPDATE "foo" SET "a" = 1 RETURNING * 8 | UPDATE "foo" SET "a" = 1 RETURNING "a" 9 | UPDATE "foo" SET "a" = 1 RETURNING "a","b" 10 | syntax error: UPDATE foo SET a = 1 WHERE CURRENT OF $1 11 | UPDATE "foo" SET "a" = 1 WHERE CURRENT OF cur 12 | -------------------------------------------------------------------------------- /src/test/parser/expected/var.out: -------------------------------------------------------------------------------- 1 | SET var TO 'val' 2 | SET var TO 'val' 3 | SET var TO DEFAULT 4 | SET var TO DEFAULT 5 | SET TIME ZONE 'val' 6 | SET TIME ZONE 'val' 7 | SET TIME ZONE 8 | SET TIME ZONE 9 | SET LOCAL TIME ZONE 10 | SET TIME ZONE 11 | SET var FROM CURRENT 12 | SET XML OPTION DOCUMENT 13 | SET XML OPTION CONTENT 14 | syntax error: show 'x'; 15 | SHOW x 16 | SHOW ALL 17 | RESET x 18 | RESET ALL 19 | RESET TIME ZONE 20 | RESET TRANSACTION ISOLATION LEVEL 21 | RESET SESSION AUTHORIZATION 22 | syntax error: reset 'x'; 23 | -------------------------------------------------------------------------------- /src/test/parser/input/alter.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE foo ; 2 | ALTER TEXT SEARCH CONFIGURATION 3 | -------------------------------------------------------------------------------- /src/test/parser/input/copy.sql: -------------------------------------------------------------------------------- 1 | COPY t FROM 'xxx'; 2 | COPY t FROM stdin; 3 | COPY t(x,y) FROM 'xxx'; 4 | COPY t FROM 'xxx' BINARY; 5 | COPY t FROM 'xxx' CSV HEADER QUOTE AS '#' ESCAPE AS '$' FORCE NOT NULL foo,bar; 6 | COPY t FROM 'xxx' OIDS; 7 | COPY t FROM 'xxx' DELIMITER ','; 8 | COPY t FROM 'xxx' NULL 'x'; 9 | COPY t TO 'yyy'; 10 | COPY t TO stdout; 11 | COPY t(x,y) TO 'yyy'; 12 | COPY t TO 'yyy' BINARY; 13 | COPY t FROM 'xxx' CSV HEADER QUOTE AS '#' ESCAPE AS '$' FORCE QUOTE foo,bar; 14 | COPY t TO 'yyy' OIDS; 15 | COPY t TO 'yyy' DELIMITER ','; 16 | COPY t TO 'yyy' NULL 'x'; 17 | COPY (SELECT * FROM t) TO 'xxx'; 18 | -------------------------------------------------------------------------------- /src/test/parser/input/cursor.sql: -------------------------------------------------------------------------------- 1 | DECLARE xx CURSOR FOR SELECT * FROM t; 2 | DECLARE xx BINARY CURSOR FOR SELECT * FROM t; 3 | DECLARE xx INSENSITIVE CURSOR FOR SELECT * FROM t; 4 | DECLARE xx SCROLL CURSOR FOR SELECT * FROM t; 5 | DECLARE xx CURSOR WITH HOLD FOR SELECT * FROM t; 6 | DECLARE xx CURSOR WITHOUT HOLD FOR SELECT * FROM t; 7 | CLOSE xx; 8 | FETCH IN xx; 9 | FETCH NEXT IN xx; 10 | FETCH PRIOR IN xx; 11 | FETCH LAST IN xx; 12 | FETCH ABSOLUTE 2 IN xx; 13 | FETCH RELATIVE 2 IN xx; 14 | FETCH 1 IN xx; 15 | FETCH ALL IN xx; 16 | FETCH FORWARD IN xx; 17 | FETCH FORWARD 2 IN xx; 18 | FETCH FORWARD ALL IN xx; 19 | FETCH BACKWARD IN xx; 20 | FETCH BACKWARD 3 IN xx; 21 | FETCH BACKWARD ALL IN xx; 22 | FETCH BACKWARD ALL FROM xx; 23 | MOVE IN xx; 24 | MOVE NEXT IN xx; 25 | MOVE PRIOR IN xx; 26 | MOVE LAST IN xx; 27 | MOVE ABSOLUTE 2 IN xx; 28 | MOVE RELATIVE 2 IN xx; 29 | MOVE 1 IN xx; 30 | MOVE ALL IN xx; 31 | MOVE FORWARD IN xx; 32 | MOVE FORWARD 2 IN xx; 33 | MOVE FORWARD ALL IN xx; 34 | MOVE BACKWARD IN xx; 35 | MOVE BACKWARD 3 IN xx; 36 | MOVE BACKWARD ALL IN xx; 37 | MOVE BACKWARD ALL FROM xx; 38 | -------------------------------------------------------------------------------- /src/test/parser/input/delete.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM t; 2 | DELETE ; 3 | DELETE FROM ONLY xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; 4 | DELETE FROM t WHERE x = 3; 5 | DELETE FROM t WHERE x IN (select * from t1); 6 | DELETE FROM foo WHERE a = 1 RETURNING *; 7 | DELETE FROM foo WHERE a = 1 RETURNING a; 8 | DELETE FROM foo WHERE a = 1 RETURNING a,b; 9 | DELETE FROM foo WHERE CURRENT OF $1 10 | DELETE FROM foo WHERE CURRENT OF cur 11 | -------------------------------------------------------------------------------- /src/test/parser/input/drop.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE foo 2 | DROP OWNED BY role_a 3 | DROP OWNED BY role_a CASCADE 4 | DROP OWNED BY role_a RESTRICT 5 | DROP OWNED BY role_a, role_b, role_c 6 | REASSIGN OWNED BY role_a TO role_b 7 | REASSIGN OWNED BY role_a, role1 TO role_b 8 | DROP OPERATOR FAMILY foo USING bar 9 | DROP OPERATOR FAMILY IF EXISTS foo USING bar 10 | DROP OPERATOR FAMILY foo USING 11 | DROP ROLE foo 12 | DROP ROLE IF EXISTS foo 13 | -------------------------------------------------------------------------------- /src/test/parser/input/insert.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO t values (1); 2 | INSERT INTO t(a) VALUES (2); 3 | INSERT INTO t(a,b,c) VALUES (2,2); 4 | INSERT INTO t(a,b,c) VALUES (2,2,3); 5 | INSERT INTO t(a,b,c) VALUES (2,DEFAULT,'3'); 6 | INSERT INTO t DEFAULT VALUES; 7 | INSERT INTO t SELECT * FROM t; 8 | INSERT INTO t values (func(x, y)); 9 | INSERT INTO t(a,b,c) VALUES (2,DEFAULT,'\'\\'); 10 | INSERT INTO foo(a,b) VALUES (1, 2) RETURNING *; 11 | INSERT INTO foo(a,b) VALUES (1, 2) RETURNING a; 12 | INSERT INTO foo(a,b) VALUES (1, 2) RETURNING a,b; 13 | INSERT INTO foo(a,b) VALUES (1, 2), (3, 4), (5, 6); 14 | -------------------------------------------------------------------------------- /src/test/parser/input/misc.sql: -------------------------------------------------------------------------------- 1 | VACUUM; 2 | VACUUM FULL; 3 | VACUUM FULL FREEZE; 4 | VACUUM FULL FREEZE VERBOSE; 5 | VACUUM FULL FREEZE VERBOSE ANALYZE; 6 | VACUUM FULL t; 7 | ANALYZE 8 | ANALYZE VERBOSE 9 | ANALYZE VERBOSE x 10 | ANALYZE VERBOSE x(a,b,c); 11 | EXPLAIN SELECT * FROM t; 12 | EXPLAIN ANALYZE SELECT * FROM t; 13 | EXPLAIN ANALYZE VERBOSE SELECT * FROM t; 14 | REINDEX INDEX x 15 | REINDEX INDEX x force 16 | REINDEX TABLE x 17 | REINDEX TABLE x force 18 | REINDEX DATABASE x 19 | REINDEX DATABASE x force 20 | REINDEX SYSTEM x 21 | REINDEX SYSTEM x force 22 | LISTEN x 23 | NOTIFY x 24 | DISCARD ALL 25 | DISCARD TEMP 26 | DISCARD TEMPORARY 27 | DISCARD PLANS 28 | DISCARD xxx 29 | -------------------------------------------------------------------------------- /src/test/parser/input/prepare.sql: -------------------------------------------------------------------------------- 1 | PREPARE xx(integer, text) AS INSERT INTO foo VALUES ($1, $2); 2 | EXECUTE xx(1, 'xxx'); 3 | DEALLOCATE xx; 4 | DEALLOCATE PREPARE xx; 5 | -------------------------------------------------------------------------------- /src/test/parser/input/scanner.sql: -------------------------------------------------------------------------------- 1 | \pset standard_conforming_strings off 2 | SELECT '\''; 3 | SELECT ''''; 4 | SELECT 'A\nBC'; 5 | SELECT E'A\nBC'; 6 | SELECT U&'d\0061t\+000061'; --error 7 | \pset standard_conforming_strings on 8 | SELECT '\''; -- error 9 | SELECT ''''; 10 | SELECT 'A\nBC'; 11 | SELECT E'A\nBC'; 12 | 13 | \pset server_encoding SQL_ASCII 14 | # unicode ident 15 | SELECT * FROM U&"d\0061t\+000061"; 16 | # unicode literal 17 | SELECT E'd\u0061t\U00000061'; 18 | SELECT U&'d\0061t\+000061'; 19 | SELECT U&'d!0061t!+000061' UESCAPE '!'; 20 | SELECT E'\u3042\u3044\u3046\u3048\u304a'; -- error 21 | SELECT U&'\3042\3044\3046\3048\304a'; -- error 22 | 23 | \pset server_encoding UTF8 24 | # unicode ident 25 | SELECT * FROM U&"d\0061t\+000061"; 26 | # unicode literal 27 | SELECT E'd\u0061t\U00000061'; 28 | SELECT U&'d\0061t\+000061'; 29 | SELECT U&'d!0061t!+000061' UESCAPE '!'; 30 | SELECT E'\u3042\u3044\u3046\u3048\u304a'; 31 | SELECT U&'\3042\3044\3046\3048\304a'; 32 | # surrogate pair 33 | SELECT E'\ud800\udc00'; 34 | SELECT U&'\d800\dc00'; 35 | -------------------------------------------------------------------------------- /src/test/parser/input/transaction.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | BEGIN WORK; 3 | BEGIN TRANSACTION; 4 | BEGIN ISOLATION LEVEL READ COMMITTED; 5 | BEGIN ISOLATION LEVEL SERIALIZABLE; 6 | BEGIN READ WRITE; 7 | BEGIN READ ONLY; 8 | START TRANSACTION; 9 | COMMIT; 10 | COMMIT WORK; 11 | COMMIT TRANSACTION; 12 | END; 13 | END WORK; 14 | END TRANSACTION; 15 | ROLLBACK; 16 | ROLLBACK WORK; 17 | ROLLBACK TRANSACTION; 18 | ABORT; 19 | ABORT WORK; 20 | ABORT TRANSACTION; 21 | SET TRANSACTION ISOLATION LEVEL READ COMMITTED; 22 | SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; 23 | SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED; 24 | SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE; 25 | SET CONSTRAINTS ALL DEFERRED; 26 | SET CONSTRAINTS ALL IMMEDIATE; 27 | SET CONSTRAINTS x DEFERRED; 28 | SET CONSTRAINTS x IMMEDIATE; 29 | LOCK TABLE t1,t2; 30 | LOCK t1,t2; 31 | LOCK TABLE t1,t2 IN ACCESS SHARE MODE; 32 | LOCK TABLE t1,t2 IN ROW SHARE MODE; 33 | LOCK TABLE t1,t2 IN ROW EXCLUSIVE MODE; 34 | LOCK TABLE t1,t2 IN SHARE UPDATE EXCLUSIVE MODE; 35 | LOCK TABLE t1,t2 IN SHARE MODE; 36 | LOCK TABLE t1,t2 IN SHARE ROW EXCLUSIVE MODE; 37 | LOCK TABLE t1,t2 IN EXCLUSIVE MODE; 38 | LOCK TABLE t1,t2 IN ACCESS EXCLUSIVE MODE; 39 | -------------------------------------------------------------------------------- /src/test/parser/input/update.sql: -------------------------------------------------------------------------------- 1 | UPDATE t set a = 1; 2 | UPDATE t set a = 3, b = 'a', c = NULL, d = DEFAULT; 3 | UPDATE t set a = 1 FROM x; 4 | UPDATE t set a = 1 FROM x,y,z; 5 | UPDATE t set a = 1 FROM x where x < 100 and y > 200; 6 | UPDATE ONLY t set a = 1; 7 | UPDATE foo SET a = 1 RETURNING *; 8 | UPDATE foo SET a = 1 RETURNING a; 9 | UPDATE foo SET a = 1 RETURNING a,b; 10 | UPDATE foo SET a = 1 WHERE CURRENT OF $1 11 | UPDATE foo SET a = 1 WHERE CURRENT OF cur 12 | -------------------------------------------------------------------------------- /src/test/parser/input/var.sql: -------------------------------------------------------------------------------- 1 | SET var TO val 2 | SET var TO 'val' 3 | SET var TO DEFAULT 4 | SET var = DEFAULT 5 | SET TIME ZONE val 6 | SET TIME ZONE 'val' 7 | SET TIME ZONE local 8 | SET TIME ZONE default 9 | SET local TIME ZONE default 10 | SET session TIME ZONE default 11 | SET var FROM CURRENT 12 | SET XML OPTION DOCUMENT 13 | SET XML OPTION CONTENT 14 | show 'x'; 15 | show x; 16 | show all; 17 | reset x; 18 | reset all; 19 | reset time zone; 20 | reset transaction isolation level 21 | reset session authorization 22 | reset 'x'; 23 | -------------------------------------------------------------------------------- /src/test/parser/parse_schedule: -------------------------------------------------------------------------------- 1 | select 2 | insert 3 | update 4 | delete 5 | misc 6 | var 7 | copy 8 | privileges 9 | transaction 10 | cursor 11 | prepare 12 | create 13 | drop 14 | scanner 15 | v84 16 | v90 17 | -------------------------------------------------------------------------------- /src/test/parser/pool.h: -------------------------------------------------------------------------------- 1 | #ifndef POOL_H 2 | #define POOL_H 3 | 4 | #include 5 | #include 6 | 7 | #define pool_error printf 8 | #define child_exit exit 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/test/parser/run-test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/src/test/parser/run-test -------------------------------------------------------------------------------- /src/test/pdo-test/README.euc_jp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/src/test/pdo-test/README.euc_jp -------------------------------------------------------------------------------- /src/test/pdo-test/SQLlist/test1.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | SELECT 1; 3 | END; 4 | -------------------------------------------------------------------------------- /src/test/pdo-test/SQLlist/test2.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | select 2; 3 | END; 4 | -------------------------------------------------------------------------------- /src/test/pdo-test/collections.inc: -------------------------------------------------------------------------------- 1 | "; 8 | } 9 | return $result; 10 | } 11 | ?> 12 | -------------------------------------------------------------------------------- /src/test/pdo-test/def.inc: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/test/pdo-test/mod/database.inc: -------------------------------------------------------------------------------- 1 | 2 | 3 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);; 11 | return $dbh; 12 | } catch (Exception $e) { 13 | echo "fail : " .$e->getMessage()."
"; 14 | ErrorResult($php_errormsg); 15 | return NULL; 16 | } 17 | } 18 | 19 | function trans_end($dbh,$trans) { 20 | try { 21 | $stmt = $dbh->prepare($trans); 22 | $stmt->execute(); 23 | print_r($stmt->fetch()); 24 | } catch (Exception $e) { 25 | ErrorResult($php_errormsg); 26 | } 27 | } 28 | 29 | function ErrorResult($php_errormsg) { 30 | header('HTTP/1.0 402 SQL ERROR'); 31 | require_once("errorhandler.inc"); 32 | set_error_handler("userErrorHandler"); 33 | trigger_error($php_errormsg, E_USER_ERROR); 34 | exit; 35 | } 36 | ?> 37 | -------------------------------------------------------------------------------- /src/test/pdo-test/mod/errorhandler.inc: -------------------------------------------------------------------------------- 1 | "Error", 6 | 2 => "Warning", 7 | 4 => "Parsing Error", 8 | 8 => "Notice", 9 | 16 => "Core Error", 10 | 32 => "Core Warning", 11 | 64 => "Compile Error", 12 | 128 => "Compile Warning", 13 | 256 => "User Error", 14 | 512 => "User Warning", 15 | 1024=> "User Notice" 16 | ); 17 | $err = $dt." "; 18 | $err .= $errortype[$error]." "; 19 | $err .= $errmsg." "; 20 | $err .= $filename." "; 21 | $err .= $linenum."\n"; 22 | $filename='log.txt'; 23 | $handle = fopen($filename, 'a'); 24 | fwrite($handle, $err); 25 | fclose($handle); 26 | } 27 | ?> 28 | -------------------------------------------------------------------------------- /src/test/pdo-test/pdotest.php: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /src/test/pdo-test/regsql.inc: -------------------------------------------------------------------------------- 1 | "; 53 | trans_end($con,$sql); 54 | } 55 | } 56 | ?> 57 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/expected/expected2-r: -------------------------------------------------------------------------------- 1 | SELECT f1(1); -- this does load balance 2 | NOTICE: DB node id: 1 statement: SELECT f1(1); 3 | f1 4 | ---- 5 | 1 6 | (1 row) 7 | 8 | SELECT public.f2(1); -- this does load balance 9 | NOTICE: DB node id: 1 statement: SELECT public.f2(1); 10 | f2 11 | ---- 12 | 1 13 | (1 row) 14 | 15 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/expected/expected2-s: -------------------------------------------------------------------------------- 1 | SELECT f1(1); -- this does load balance 2 | NOTICE: DB node id: 1 statement: SELECT f1(1); 3 | f1 4 | ---- 5 | 1 6 | (1 row) 7 | 8 | SELECT public.f2(1); -- this does load balance 9 | NOTICE: DB node id: 1 statement: SELECT public.f2(1); 10 | f2 11 | ---- 12 | 1 13 | (1 row) 14 | 15 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/expected/expected3-r: -------------------------------------------------------------------------------- 1 | SELECT * FROM t1; 2 | NOTICE: DB node id: 1 statement: SELECT * FROM t1; 3 | i 4 | --- 5 | (0 rows) 6 | 7 | SELECT 'a'; 8 | NOTICE: DB node id: 1 statement: SELECT 'a'; 9 | ?column? 10 | ---------- 11 | a 12 | (1 row) 13 | 14 | SELECT 1; 15 | NOTICE: DB node id: 1 statement: SELECT 1; 16 | ?column? 17 | ---------- 18 | 1 19 | (1 row) 20 | 21 | SELECT ';'; 22 | NOTICE: DB node id: 1 statement: SELECT ';'; 23 | ?column? 24 | ---------- 25 | ; 26 | (1 row) 27 | 28 | SELECT * FROM t2; 29 | NOTICE: DB node id: 1 statement: SELECT * FROM t2; 30 | i 31 | --- 32 | (0 rows) 33 | 34 | SELECT f1(1); 35 | NOTICE: DB node id: 1 statement: SELECT f1(1); 36 | f1 37 | ---- 38 | 1 39 | (1 row) 40 | 41 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/expected/expected3-s: -------------------------------------------------------------------------------- 1 | SELECT * FROM t1; 2 | NOTICE: DB node id: 0 statement: SELECT * FROM t1; 3 | i 4 | --- 5 | (0 rows) 6 | 7 | SELECT 'a'; 8 | NOTICE: DB node id: 0 statement: SELECT 'a'; 9 | ?column? 10 | ---------- 11 | a 12 | (1 row) 13 | 14 | SELECT 1; 15 | NOTICE: DB node id: 0 statement: SELECT 1; 16 | ?column? 17 | ---------- 18 | 1 19 | (1 row) 20 | 21 | SELECT ';'; 22 | NOTICE: DB node id: 0 statement: SELECT ';'; 23 | ?column? 24 | ---------- 25 | ; 26 | (1 row) 27 | 28 | SELECT * FROM t2; 29 | NOTICE: DB node id: 0 statement: SELECT * FROM t2; 30 | i 31 | --- 32 | (0 rows) 33 | 34 | SELECT f1(1); 35 | NOTICE: DB node id: 0 statement: SELECT f1(1); 36 | f1 37 | ---- 38 | 1 39 | (1 row) 40 | 41 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/expected/expected4-r: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | NOTICE: DB node id: 0 statement: BEGIN; 3 | NOTICE: DB node id: 1 statement: BEGIN; 4 | SELECT 1; 5 | NOTICE: DB node id: 0 statement: SELECT 1; 6 | ?column? 7 | ---------- 8 | 1 9 | (1 row) 10 | 11 | END; 12 | NOTICE: DB node id: 1 statement: END; 13 | NOTICE: DB node id: 0 statement: END; 14 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/expected/expected5-r: -------------------------------------------------------------------------------- 1 | SELECT f1(2); -- this should be sent to all the nodes 2 | NOTICE: DB node id: 0 statement: SELECT f1(2); 3 | NOTICE: DB node id: 1 statement: SELECT f1(2); 4 | f1 5 | ---- 6 | 2 7 | (1 row) 8 | 9 | -------------------------------------------------------------------------------- /src/test/regression/tests/001.load_balance/sql/6.sql: -------------------------------------------------------------------------------- 1 | SELECT f1(1); -- no load balance because volatile function 2 | SELECT public.f2(1); -- no load balance because volatile function 3 | SELECT f3(1); -- load balance because statble function 4 | SELECT public.f4(1); -- load balance because stable function 5 | PREPARE p1 AS SELECT f1(1); -- no load balance because volatile function 6 | EXECUTE p1; -- no load balance because volatile function 7 | DEALLOCATE p1; -- no load balance because volatile function 8 | PREPARE p2 AS SELECT f3(1); -- load balance because stable function 9 | EXECUTE p2; -- load balance because stable function 10 | DEALLOCATE p2; -- load balance because stable function 11 | -- PREPARE in transaction test 12 | BEGIN; 13 | PREPARE p3 AS SELECT 1; -- load balance 14 | EXECUTE p3; -- load balance 15 | DEALLOCATE p3; -- load balance 16 | END; 17 | -- PREPARE in writing transaction test 18 | BEGIN; 19 | PREPARE p3 AS SELECT 1; -- load balance 20 | SELECT f1(1); -- no load balance. writing transaction is set 21 | -- PREPARE is re-execute and EXECUTE no load balance in SL_MODE. 22 | -- in other mode, load balance 23 | EXECUTE p3; 24 | -- no load balance in SL_MODE. 25 | -- in other mode, load balance 26 | DEALLOCATE p3; 27 | END; 28 | -------------------------------------------------------------------------------- /src/test/regression/tests/002.native_replication/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/002.native_replication/create.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE sequencetester 2 | ( 3 | id serial NOT NULL, 4 | recordno integer, 5 | CONSTRAINT sq_pk PRIMARY KEY (id ) 6 | ) 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/003.failover/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/003.failover/create_expected.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMP TABLE tmp ( 2 | node_id text, 3 | hostname text, 4 | port text, 5 | status text, 6 | pg_status text, 7 | lb_weight text, 8 | role text, 9 | pg_role text, 10 | select_cnt text, 11 | load_balance_node text, 12 | replication_delay text, 13 | replication_state text, 14 | replication_sync_state text, 15 | last_status_change text, 16 | mode text); 17 | 18 | INSERT INTO tmp VALUES 19 | ('0','localhost','11002','up','up','0.500000','primary','unknown','0','false','0','','','XXXX-XX-XX XX:XX:XX','s'), 20 | ('1','localhost','11003','down','down','0.500000','standby','unknown','0','false','0','','','XXXX-XX-XX XX:XX:XX','s'), 21 | ('0','localhost','11002','up','up','0.500000','main','main','0','false','0','','','XXXX-XX-XX XX:XX:XX','r'), 22 | ('1','localhost','11003','down','down','0.500000','replica','replica','0','false','0','','','XXXX-XX-XX XX:XX:XX','r'); 23 | 24 | SELECT node_id,hostname,port,status,pg_status,lb_weight,role,pg_role,select_cnt,load_balance_node,replication_delay,replication_state, replication_sync_state, last_status_change 25 | FROM tmp 26 | WHERE mode = :mode 27 | -------------------------------------------------------------------------------- /src/test/regression/tests/003.failover/create_expected_node0.sql: -------------------------------------------------------------------------------- 1 | CREATE TEMP TABLE tmp ( 2 | node_id text, 3 | hostname text, 4 | port text, 5 | status text, 6 | pg_status text, 7 | lb_weight text, 8 | role text, 9 | pg_role text, 10 | select_cnt text, 11 | load_balance_node text, 12 | replication_delay text, 13 | replication_state text, 14 | replication_sync_state text, 15 | last_status_change text, 16 | mode text); 17 | 18 | INSERT INTO tmp VALUES 19 | ('0','localhost','11002','down','down','0.500000','standby','unknown','0','false','0','','','XXXX-XX-XX XX:XX:XX','s'), 20 | ('1','localhost','11003','up','up','0.500000','primary','unknown','0','false','0','','','XXXX-XX-XX XX:XX:XX','s'), 21 | ('0','localhost','11002','down','down','0.500000','replica','replica','0','false','0','','','XXXX-XX-XX XX:XX:XX','r'), 22 | ('1','localhost','11003','up','up','0.500000','main','main','0','false','0','','','XXXX-XX-XX XX:XX:XX','r'); 23 | 24 | SELECT node_id,hostname,port,status,pg_status,lb_weight,role,pg_role,select_cnt,load_balance_node,replication_delay,replication_state, replication_sync_state, last_status_change 25 | FROM tmp 26 | WHERE mode = :mode 27 | -------------------------------------------------------------------------------- /src/test/regression/tests/004.watchdog/.gitignore: -------------------------------------------------------------------------------- 1 | leader/ 2 | standby/ 3 | -------------------------------------------------------------------------------- /src/test/regression/tests/004.watchdog/leader.conf: -------------------------------------------------------------------------------- 1 | # leader watchdog 2 | use_watchdog = on 3 | wd_interval = 1 4 | wd_priority = 2 5 | 6 | hostname0 = 'localhost' 7 | wd_port0 = 21004 8 | pgpool_port0 = 11000 9 | hostname1 = 'localhost' 10 | wd_port1 = 21104 11 | pgpool_port0 = 11100 12 | 13 | heartbeat_hostname0 = 'localhost' 14 | heartbeat_port0 = 21005 15 | heartbeat_hostname1 = 'localhost' 16 | heartbeat_port01 = 21105 17 | 18 | enable_consensus_with_half_votes = on 19 | -------------------------------------------------------------------------------- /src/test/regression/tests/004.watchdog/standby.conf: -------------------------------------------------------------------------------- 1 | # standby watchdog 2 | port = 11100 3 | pcp_port = 11105 4 | use_watchdog = on 5 | wd_interval = 1 6 | wd_priority = 1 7 | 8 | hostname0 = 'localhost' 9 | wd_port0 = 21004 10 | pgpool_port0 = 11000 11 | hostname1 = 'localhost' 12 | wd_port1 = 21104 13 | pgpool_port0 = 11100 14 | 15 | heartbeat_hostname0 = 'localhost' 16 | heartbeat_port0 = 21005 17 | heartbeat_hostname1 = 'localhost' 18 | heartbeat_port01 = 21105 19 | 20 | enable_consensus_with_half_votes = on 21 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/InsertTest.java: -------------------------------------------------------------------------------- 1 | import java.sql.*; 2 | 3 | public class InsertTest extends PgpoolTest { 4 | public void do_test() throws SQLException { 5 | int N = 100; 6 | 7 | try { 8 | ResultSet rs; 9 | PreparedStatement pstmt = null; 10 | Statement stmt = null; 11 | 12 | for (int i = 0; i < N; i++) { 13 | connection.setAutoCommit(false); 14 | pstmt = connection.prepareStatement("INSERT INTO ins VALUES (?)"); 15 | pstmt.setInt(1, i); 16 | pstmt.executeUpdate(); 17 | pstmt.close(); 18 | connection.commit(); 19 | } 20 | connection.setAutoCommit(true); 21 | stmt = connection.createStatement(); 22 | rs = stmt.executeQuery("SELECT count(a) FROM ins" ); 23 | rs.next(); 24 | logwriter.println(rs.getInt(1)); 25 | } 26 | finally { 27 | connection.close(); 28 | } 29 | } 30 | 31 | public String getTestName() { 32 | return "insert"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/LockTest.java: -------------------------------------------------------------------------------- 1 | import java.sql.*; 2 | import java.io.*; 3 | 4 | public class LockTest extends PgpoolTest { 5 | public final int COUNT = 100; 6 | 7 | public void do_test() throws SQLException, IOException { 8 | PreparedStatement pstmt = null; 9 | Statement stmt = null; 10 | ResultSet rs = null; 11 | try{ 12 | for (int i = 0; i < COUNT; i++) { 13 | connection.setAutoCommit(false); 14 | /* table lock */ 15 | stmt = connection.createStatement(); 16 | stmt.executeUpdate("LOCK locktest"); 17 | 18 | pstmt = connection.prepareStatement("SELECT * FROM locktest"); 19 | rs = pstmt.executeQuery(); 20 | rs.next(); 21 | logwriter.println(rs.getInt(1)); 22 | rs.close(); 23 | connection.commit(); 24 | } 25 | } finally { 26 | if (connection != null) { 27 | connection.close(); 28 | } 29 | 30 | } 31 | } 32 | 33 | public String getTestName() { 34 | return "lock"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/README.euc_jp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/src/test/regression/tests/005.jdbc/README.euc_jp -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/SelectTest.java: -------------------------------------------------------------------------------- 1 | import java.sql.*; 2 | import java.io.*; 3 | 4 | public class SelectTest extends PgpoolTest { 5 | public void do_test() throws SQLException { 6 | try { 7 | for (int i = 0; i < 1; i++) { 8 | connection.setAutoCommit(false); 9 | Statement stmt = null; 10 | PreparedStatement pstmt = null; 11 | ResultSet rs = null; 12 | 13 | pstmt = connection.prepareStatement("SELECT count(*) FROM sel"); 14 | rs = pstmt.executeQuery(); 15 | rs.next(); 16 | logwriter.println(rs.getInt(1)); 17 | rs.close(); 18 | pstmt.close(); 19 | 20 | pstmt = connection.prepareStatement("SELECT sum(a) FROM sel"); 21 | rs = pstmt.executeQuery(); 22 | rs.next(); 23 | logwriter.println(rs.getInt(1)); 24 | rs.close(); 25 | pstmt.close(); 26 | connection.commit(); 27 | } 28 | } finally { 29 | connection.close(); 30 | logwriter.close(); 31 | } 32 | } 33 | 34 | public String getTestName() { 35 | return "select"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/UpdateTest.java: -------------------------------------------------------------------------------- 1 | import java.sql.*; 2 | 3 | public class UpdateTest extends PgpoolTest { 4 | public void do_test() throws SQLException { 5 | int N = 100; 6 | 7 | try { 8 | ResultSet rs; 9 | Statement stmt = null; 10 | 11 | for (int i = 0; i < N; i++) { 12 | connection.setAutoCommit(false); 13 | stmt = connection.createStatement(); 14 | stmt.executeUpdate("UPDATE up SET a = a + 1" ); 15 | stmt.close(); 16 | connection.commit(); 17 | } 18 | connection.setAutoCommit(true); 19 | stmt = connection.createStatement(); 20 | rs = stmt.executeQuery("SELECT max(a) FROM up" ); 21 | rs.next(); 22 | logwriter.println(rs.getInt(1)); 23 | } 24 | finally { 25 | connection.close(); 26 | } 27 | } 28 | 29 | public String getTestName() { 30 | return "update"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected.txt: -------------------------------------------------------------------------------- 1 | autocommit: ok 2 | batch: ok 3 | column: ok 4 | lock: ok 5 | select: ok 6 | update: ok 7 | insert: ok 8 | CreateTempTable: ok 9 | PrepareThreshold: ok 10 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/CreateTempTable: -------------------------------------------------------------------------------- 1 | 200 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/PrepareThreshold: -------------------------------------------------------------------------------- 1 | 30 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/autocommit: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/batch: -------------------------------------------------------------------------------- 1 | 11 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/column: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 5 | 1 6 | 1 7 | 1 8 | 1 9 | 1 10 | 1 11 | 1 12 | 1 13 | 1 14 | 1 15 | 1 16 | 1 17 | 1 18 | 1 19 | 1 20 | 1 21 | 1 22 | 1 23 | 1 24 | 1 25 | 1 26 | 1 27 | 1 28 | 1 29 | 1 30 | 1 31 | 1 32 | 1 33 | 1 34 | 1 35 | 1 36 | 1 37 | 1 38 | 1 39 | 1 40 | 1 41 | 1 42 | 1 43 | 1 44 | 1 45 | 1 46 | 1 47 | 1 48 | 1 49 | 1 50 | 1 51 | 1 52 | 1 53 | 1 54 | 1 55 | 1 56 | 1 57 | 1 58 | 1 59 | 1 60 | 1 61 | 1 62 | 1 63 | 1 64 | 1 65 | 1 66 | 1 67 | 1 68 | 1 69 | 1 70 | 1 71 | 1 72 | 1 73 | 1 74 | 1 75 | 1 76 | 1 77 | 1 78 | 1 79 | 1 80 | 1 81 | 1 82 | 1 83 | 1 84 | 1 85 | 1 86 | 1 87 | 1 88 | 1 89 | 1 90 | 1 91 | 1 92 | 1 93 | 1 94 | 1 95 | 1 96 | 1 97 | 1 98 | 1 99 | 1 100 | 1 101 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/insert: -------------------------------------------------------------------------------- 1 | 100 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/lock: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 1 5 | 1 6 | 1 7 | 1 8 | 1 9 | 1 10 | 1 11 | 1 12 | 1 13 | 1 14 | 1 15 | 1 16 | 1 17 | 1 18 | 1 19 | 1 20 | 1 21 | 1 22 | 1 23 | 1 24 | 1 25 | 1 26 | 1 27 | 1 28 | 1 29 | 1 30 | 1 31 | 1 32 | 1 33 | 1 34 | 1 35 | 1 36 | 1 37 | 1 38 | 1 39 | 1 40 | 1 41 | 1 42 | 1 43 | 1 44 | 1 45 | 1 46 | 1 47 | 1 48 | 1 49 | 1 50 | 1 51 | 1 52 | 1 53 | 1 54 | 1 55 | 1 56 | 1 57 | 1 58 | 1 59 | 1 60 | 1 61 | 1 62 | 1 63 | 1 64 | 1 65 | 1 66 | 1 67 | 1 68 | 1 69 | 1 70 | 1 71 | 1 72 | 1 73 | 1 74 | 1 75 | 1 76 | 1 77 | 1 78 | 1 79 | 1 80 | 1 81 | 1 82 | 1 83 | 1 84 | 1 85 | 1 86 | 1 87 | 1 88 | 1 89 | 1 90 | 1 91 | 1 92 | 1 93 | 1 94 | 1 95 | 1 96 | 1 97 | 1 98 | 1 99 | 1 100 | 1 101 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/select: -------------------------------------------------------------------------------- 1 | 100 2 | 5050 3 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/expected/update: -------------------------------------------------------------------------------- 1 | 102 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/005.jdbc/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | rm -f *.class 4 | rm -f result/* 5 | javac *.java 6 | java RunTest 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/alter_database1.data: -------------------------------------------------------------------------------- 1 | # Testing ALTER DATABASE 2 | # create cache 3 | 'P' "" "SELECT * FROM t1" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | # execute ALTER DATABASE 9 | 'P' "" "ALTER DATABASE test2 RESET ALL" 10 | 'B' "" "" 0 0 0 11 | 'E' "" 0 12 | 'S' 13 | 'Y' 14 | # Make sure cache is not used 15 | 'P' "" "SELECT * FROM t1" 16 | 'B' "" "" 0 0 0 17 | 'E' "" 0 18 | 'S' 19 | 'Y' 20 | # explicit transaction case 21 | 'P' "" "BEGIN" 22 | 'B' "" "" 0 0 0 23 | 'E' "" 0 24 | 'S' 25 | 'Y' 26 | 'P' "" "ALTER DATABASE test2 RESET ALL" 27 | 'B' "" "" 0 0 0 28 | 'E' "" 0 29 | 'S' 30 | 'Y' 31 | # Make sure cache is not used 32 | 'P' "" "SELECT * FROM t1" 33 | 'B' "" "" 0 0 0 34 | 'E' "" 0 35 | 'S' 36 | 'Y' 37 | 'P' "" "END" 38 | 'B' "" "" 0 0 0 39 | 'E' "" 0 40 | 'S' 41 | 'Y' 42 | 'P' "" "SELECT * FROM t1" 43 | 'B' "" "" 0 0 0 44 | 'E' "" 0 45 | 'S' 46 | 'Y' 47 | # Make sure cache is used 48 | 'P' "" "SELECT * FROM t1" 49 | 'B' "" "" 0 0 0 50 | 'E' "" 0 51 | 'S' 52 | 'Y' 53 | 'X' 54 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/alter_database2.data: -------------------------------------------------------------------------------- 1 | # ALTER DATABASE is executed on another session case 2 | # Make sure to create cache (sync needed) 3 | 'P' "" "SELECT * FROM t1" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | 'P' "" "SELECT * FROM t1" 9 | 'B' "" "" 0 0 0 10 | 'E' "" 0 11 | 'S' 12 | 'Y' 13 | 'P' "" "ALTER DATABASE test2 RESET ALL" 14 | 'B' "" "" 0 0 0 15 | 'E' "" 0 16 | 'S' 17 | 'Y' 18 | 'X' 19 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/alter_database3.data: -------------------------------------------------------------------------------- 1 | # ALTER DATABASE is executed on another session case 2 | # Make sure this does not access cache 3 | 'P' "" "SELECT * FROM t1" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | 'X' 9 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/alter_role.data: -------------------------------------------------------------------------------- 1 | # ALTER ROLE BYPASSRLS case 2 | # Make sure to create cache (sync needed) 3 | 'P' "" "SELECT * FROM users" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | 'P' "" "SELECT * FROM users" 9 | 'B' "" "" 0 0 0 10 | 'E' "" 0 11 | 'S' 12 | 'Y' 13 | 'P' "" "ALTER ROLE foo BYPASSRLS" 14 | 'B' "" "" 0 0 0 15 | 'E' "" 0 16 | 'S' 17 | 'Y' 18 | 'P' "" "SET ROLE TO foo" 19 | 'B' "" "" 0 0 0 20 | 'E' "" 0 21 | 'S' 22 | 'Y' 23 | # expect to ignore cache and result is all rows 24 | 'P' "" "SELECT * FROM users" 25 | 'B' "" "" 0 0 0 26 | 'E' "" 0 27 | 'S' 28 | 'Y' 29 | 'P' "" "RESET ROLE" 30 | 'B' "" "" 0 0 0 31 | 'E' "" 0 32 | 'S' 33 | 'Y' 34 | 'P' "" "ALTER ROLE foo NOBYPASSRLS" 35 | 'B' "" "" 0 0 0 36 | 'E' "" 0 37 | 'S' 38 | 'Y' 39 | 'P' "" "SET ROLE TO foo" 40 | 'B' "" "" 0 0 0 41 | 'E' "" 0 42 | 'S' 43 | 'Y' 44 | # expect to ignore cache and result is one row 45 | 'P' "" "SELECT * FROM users" 46 | 'B' "" "" 0 0 0 47 | 'E' "" 0 48 | 'S' 49 | 'Y' 50 | 'X' 51 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/alter_table2.data: -------------------------------------------------------------------------------- 1 | # ALTER TABLE is executed on another session case 2 | # Make sure to create cache (sync needed) 3 | 'P' "" "SELECT * FROM t1" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | 'P' "" "SELECT * FROM t1" 9 | 'B' "" "" 0 0 0 10 | 'E' "" 0 11 | 'S' 12 | 'Y' 13 | 'P' "" "ALTER TABLE t1 ADD COLUMN j INT" 14 | 'B' "" "" 0 0 0 15 | 'E' "" 0 16 | 'S' 17 | 'Y' 18 | 'X' 19 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/alter_table3.data: -------------------------------------------------------------------------------- 1 | # ALTER TABLE is executed on another session case 2 | # Make sure this does not access cache 3 | 'P' "" "SELECT * FROM t1" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | 'X' 9 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/expected.1: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="S0", query="SELECT 1") 2 | FE=> Bind(stmt="S0", portal="P0") 3 | FE=> Describe(portal="P0") 4 | FE=> Execute(portal="P0") 5 | FE=> Sync 6 | <= BE ParseComplete 7 | <= BE BindComplete 8 | <= BE RowDescription 9 | <= BE DataRow 10 | <= BE CommandComplete(SELECT 1) 11 | <= BE ReadyForQuery(I) 12 | FE=> Parse(stmt="S1", query="SELECT 2") 13 | FE=> Bind(stmt="S1", portal="P1") 14 | FE=> Describe(portal="P1") 15 | FE=> Execute(portal="P1") 16 | FE=> Bind(stmt="S0", portal="P2") 17 | FE=> Describe(portal="P2") 18 | FE=> Execute(portal="P2") 19 | FE=> Sync 20 | <= BE ParseComplete 21 | <= BE BindComplete 22 | <= BE RowDescription 23 | <= BE DataRow 24 | <= BE CommandComplete(SELECT 1) 25 | <= BE BindComplete 26 | <= BE RowDescription 27 | <= BE DataRow 28 | <= BE CommandComplete(SELECT 1) 29 | <= BE ReadyForQuery(I) 30 | FE=> Terminate 31 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/expected.2: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="S0", query="SELECT 1") 2 | FE=> Bind(stmt="S0", portal="P0") 3 | FE=> Describe(portal="P0") 4 | FE=> Execute(portal="P0") 5 | FE=> Sync 6 | <= BE ParseComplete 7 | <= BE BindComplete 8 | <= BE RowDescription 9 | <= BE DataRow 10 | <= BE CommandComplete(SELECT 1) 11 | <= BE ReadyForQuery(I) 12 | FE=> Parse(stmt="S1", query="SELECT setseed(10)") 13 | FE=> Bind(stmt="S1", portal="P1") 14 | FE=> Describe(portal="P1") 15 | FE=> Execute(portal="P1") 16 | FE=> Bind(stmt="S0", portal="P2") 17 | FE=> Describe(portal="P2") 18 | FE=> Execute(portal="P2") 19 | FE=> Sync 20 | <= BE ParseComplete 21 | <= BE BindComplete 22 | <= BE RowDescription 23 | <= BE ErrorResponse(S ERROR V ERROR C 22023 M setseed parameter 10 is out of allowed range [-1,1] 24 | <= BE ReadyForQuery(I) 25 | FE=> Terminate 26 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/expected.3: -------------------------------------------------------------------------------- 1 | FE=> Parse(stmt="S0", query="SELECT * FROM (VALUES(1),(2)) foo") 2 | FE=> Bind(stmt="S0", portal="P0") 3 | FE=> Describe(portal="P0") 4 | FE=> Execute(portal="P0") 5 | FE=> Sync 6 | <= BE ParseComplete 7 | <= BE BindComplete 8 | <= BE RowDescription 9 | <= BE DataRow 10 | <= BE DataRow 11 | <= BE CommandComplete(SELECT 2) 12 | <= BE ReadyForQuery(I) 13 | FE=> Parse(stmt="S1", query="SELECT * FROM (VALUES(1),(2),(3)) foo") 14 | FE=> Bind(stmt="S1", portal="P1") 15 | FE=> Describe(portal="P1") 16 | FE=> Execute(portal="P1") 17 | FE=> Bind(stmt="S0", portal="P2") 18 | FE=> Describe(portal="P2") 19 | FE=> Execute(portal="P2") 20 | FE=> Sync 21 | <= BE ParseComplete 22 | <= BE BindComplete 23 | <= BE RowDescription 24 | <= BE DataRow 25 | <= BE PortalSuspended 26 | <= BE BindComplete 27 | <= BE RowDescription 28 | <= BE DataRow 29 | <= BE DataRow 30 | <= BE CommandComplete(SELECT 2) 31 | <= BE ReadyForQuery(I) 32 | FE=> Terminate 33 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/expected.5: -------------------------------------------------------------------------------- 1 | FE=> Query (query="CREATE TABLE regress_test(i int)") 2 | <= BE CommandComplete(CREATE TABLE) 3 | <= BE ReadyForQuery(I) 4 | FE=> Query (query="INSERT INTO regress_test VALUES(1)") 5 | <= BE CommandComplete(INSERT 0 1) 6 | <= BE ReadyForQuery(I) 7 | FE=> Parse(stmt="S0", query="SELECT * FROM regress_test WHERE i = 1") 8 | FE=> Bind(stmt="S0", portal="P0") 9 | FE=> Describe(portal="P0") 10 | FE=> Execute(portal="P0") 11 | FE=> Sync 12 | <= BE ParseComplete 13 | <= BE BindComplete 14 | <= BE RowDescription 15 | <= BE DataRow 16 | <= BE CommandComplete(SELECT 1) 17 | <= BE ReadyForQuery(I) 18 | FE=> Parse(stmt="S2", query="UPDATE regress_test SET i = 2") 19 | FE=> Bind(stmt="S2", portal="P2") 20 | FE=> Execute(portal="P2") 21 | FE=> Sync 22 | <= BE ParseComplete 23 | <= BE BindComplete 24 | <= BE CommandComplete(UPDATE 1) 25 | <= BE ReadyForQuery(I) 26 | FE=> Bind(stmt="S0", portal="P0") 27 | FE=> Describe(portal="P0") 28 | FE=> Execute(portal="P0") 29 | FE=> Sync 30 | <= BE BindComplete 31 | <= BE RowDescription 32 | <= BE CommandComplete(SELECT 0) 33 | <= BE ReadyForQuery(I) 34 | FE=> Query (query="DROP TABLE regress_test") 35 | <= BE CommandComplete(DROP TABLE) 36 | <= BE ReadyForQuery(I) 37 | FE=> Terminate 38 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/expected.6: -------------------------------------------------------------------------------- 1 | FE=> Query (query="CREATE TABLE regress_test(i int)") 2 | <= BE CommandComplete(CREATE TABLE) 3 | <= BE ReadyForQuery(I) 4 | FE=> Parse(stmt="S1", query="INSERT INTO regress_test VALUES(1)") 5 | FE=> Bind(stmt="S1", portal="") 6 | FE=> Execute(portal="") 7 | FE=> Sync 8 | <= BE ParseComplete 9 | <= BE BindComplete 10 | <= BE CommandComplete(INSERT 0 1) 11 | <= BE ReadyForQuery(I) 12 | FE=> Parse(stmt="S2", query="SELECT * FROM regress_test WHERE i = 1") 13 | FE=> Bind(stmt="S2", portal="") 14 | FE=> Execute(portal="") 15 | FE=> Sync 16 | <= BE ParseComplete 17 | <= BE BindComplete 18 | <= BE DataRow 19 | <= BE CommandComplete(SELECT 1) 20 | <= BE ReadyForQuery(I) 21 | FE=> Bind(stmt="S1", portal="") 22 | FE=> Execute(portal="") 23 | FE=> Sync 24 | <= BE BindComplete 25 | <= BE CommandComplete(INSERT 0 1) 26 | <= BE ReadyForQuery(I) 27 | FE=> Bind(stmt="S2", portal="") 28 | FE=> Execute(portal="") 29 | FE=> Sync 30 | <= BE BindComplete 31 | <= BE DataRow 32 | <= BE DataRow 33 | <= BE CommandComplete(SELECT 2) 34 | <= BE ReadyForQuery(I) 35 | FE=> Query (query="DROP TABLE regress_test") 36 | <= BE CommandComplete(DROP TABLE) 37 | <= BE ReadyForQuery(I) 38 | FE=> Terminate 39 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/query_cache_bug1.data: -------------------------------------------------------------------------------- 1 | # "packet kind of backend 0 ['T'] does not match with main/majority nodes packet kind ['Z']" 2 | 'P' "S0" "SELECT 1" 0 3 | 'B' "P0" "S0" 0 0 0 4 | 'D' 'P' "P0" 5 | 'E' "P0" 0 6 | 'S' 7 | 'Y' 8 | 9 | 'P' "S1" "SELECT 2" 0 10 | 'B' "P1" "S1" 0 0 0 11 | 'D' 'P' "P1" 12 | 'E' "P1" 0 13 | 14 | 'B' "P2" "S0" 0 0 0 15 | 'D' 'P' "P2" 16 | 'E' "P2" 0 17 | 18 | 'S' 19 | 'Y' 20 | 21 | 'X' 22 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/query_cache_bug2.data: -------------------------------------------------------------------------------- 1 | # test case including error response 2 | 3 | 'P' "S0" "SELECT 1" 0 4 | 'B' "P0" "S0" 0 0 0 5 | 'D' 'P' "P0" 6 | 'E' "P0" 0 7 | 'S' 8 | 'Y' 9 | 10 | # setseed parameter out of range error 11 | 'P' "S1" "SELECT setseed(10)" 0 12 | 'B' "P1" "S1" 0 0 0 13 | 'D' 'P' "P1" 14 | 'E' "P1" 0 15 | 16 | 'B' "P2" "S0" 0 0 0 17 | 'D' 'P' "P2" 18 | 'E' "P2" 0 19 | 20 | 'S' 21 | 'Y' 22 | 23 | 'X' 24 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/query_cache_bug3.data: -------------------------------------------------------------------------------- 1 | # Portal suspended test 2 | 3 | 'P' "S0" "SELECT * FROM (VALUES(1),(2)) foo" 0 4 | 'B' "P0" "S0" 0 0 0 5 | 'D' 'P' "P0" 6 | 'E' "P0" 0 7 | 'S' 8 | 'Y' 9 | 10 | 'P' "S1" "SELECT * FROM (VALUES(1),(2),(3)) foo" 0 11 | 'B' "P1" "S1" 0 0 0 12 | 'D' 'P' "P1" 13 | 'E' "P1" 1 14 | 15 | 'B' "P2" "S0" 0 0 0 16 | 'D' 'P' "P2" 17 | 'E' "P2" 0 18 | 'S' 19 | 'Y' 20 | 21 | 'X' 22 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/query_cache_bug4.data: -------------------------------------------------------------------------------- 1 | # Since the first Eexecute returns portal suspended, the second 2 | # E does not create cache. 3 | 'P' "" "SELECT * FROM (VALUES(1),(2)) v" 0 4 | 'B' "" "" 0 0 0 5 | 'D' 'P' "" 6 | 'E' "" 1 7 | 'E' "" 0 8 | 'S' 9 | 'Y' 10 | 11 | # Since no cache was created, two rows are returned, 12 | # and cache created. 13 | 'P' "" "SELECT * FROM (VALUES(1),(2)) v" 0 14 | 'B' "" "" 0 0 0 15 | 'D' 'P' "" 16 | 'E' "" 0 17 | 'S' 18 | 'Y' 19 | 20 | # This time cache is used. 2 rows are returned. 21 | 'P' "S1" "SELECT * FROM (VALUES(1),(2)) v" 0 22 | 'B' "P1" "S1" 0 0 0 23 | 'D' 'P' "P1" 24 | 'E' "P1" 0 25 | 'S' 26 | 'Y' 27 | 28 | # cache is used, 2 rows are returned. 29 | # but the second E returns 0 rows. 30 | 'B' "P1" "S1" 0 0 0 31 | 'D' 'P' "P1" 32 | 'E' "P1" 0 33 | 'E' "P1" 0 34 | 'S' 35 | 'Y' 36 | 37 | 'X' 38 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/query_cache_bug5.data: -------------------------------------------------------------------------------- 1 | # Execute UPDATE to check if the query cache is invalidated. 2 | 3 | # create a test table "regress_test". 4 | 'Q' "CREATE TABLE regress_test(i int)" 5 | 'Y' 6 | 'Q' "INSERT INTO regress_test VALUES(1)" 7 | 'Y' 8 | 9 | 'P' "S0" "SELECT * FROM regress_test WHERE i = 1" 0 10 | 'B' "P0" "S0" 0 0 0 11 | 'D' 'P' "P0" 12 | # This SELECT is expected to return 1 row and it should have created 13 | # query cache. 14 | 'E' "P0" 0 15 | 'S' 16 | 'Y' 17 | 18 | 'P' "S2" "UPDATE regress_test SET i = 2" 0 19 | 'B' "P2" "S2" 0 0 0 20 | # Set "maxrows" parameter to 1 of this execute message to trigger bug. 21 | 'E' "P2" 1 22 | 'S' 23 | 'Y' 24 | 25 | 'B' "P0" "S0" 0 0 0 26 | 'D' 'P' "P0" 27 | # This SELECT is expected to return 0 row because previous UPDATE 28 | # should have deleted the query cache. 29 | 'E' "P0" 0 30 | 'S' 31 | 'Y' 32 | 33 | # drop the test table. 34 | 'Q' "DROP TABLE regress_test" 35 | 'Y' 36 | 37 | 'X' 38 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/query_cache_bug6.data: -------------------------------------------------------------------------------- 1 | # Test case for query cache invalidation bug. 2 | # 3 | 4 | # create a test table "regress_test". 5 | 'Q' "CREATE TABLE regress_test(i int)" 6 | 'Y' 7 | 8 | # create named statement S1 for INSERT. 9 | 'P' "S1" "INSERT INTO regress_test VALUES(1)" 0 10 | 'B' "" "S1" 0 0 0 11 | 'E' "" 0 12 | 'S' 13 | 'Y' 14 | 15 | # create query cache. 16 | 'P' "S2" "SELECT * FROM regress_test WHERE i = 1" 0 17 | 'B' "" "S2" 0 0 0 18 | 'E' "" 0 19 | 'S' 20 | 'Y' 21 | 22 | # INSERT one more row without bind message. 23 | 'B' "" "S1" 0 0 0 24 | 'E' "" 0 25 | 'S' 26 | 'Y' 27 | 28 | # This should return 2 rows if query cache validation succeeds. 29 | 'B' "" "S2" 0 0 0 30 | 'E' "" 0 31 | 'S' 32 | 'Y' 33 | 34 | # drop the test table. 35 | 'Q' "DROP TABLE regress_test" 36 | 'Y' 37 | 38 | 'X' 39 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/query_cache_bug7.data: -------------------------------------------------------------------------------- 1 | # Test case for query cache invalidation bug with explicit 2 | # transaction. 3 | 4 | # create a test table "regress_test". 5 | 'Q' "CREATE TABLE regress_test(i int)" 6 | 'Y' 7 | 8 | # create named statement S1 for INSERT. 9 | 'P' "S1" "INSERT INTO regress_test VALUES(1)" 0 10 | 'B' "" "S1" 0 0 0 11 | 'E' "" 1 12 | 'S' 13 | 'Y' 14 | 15 | # create query cache. 16 | 'P' "S2" "SELECT * FROM regress_test WHERE i = 1" 0 17 | 'B' "" "S2" 0 0 0 18 | 'E' "" 0 19 | 'S' 20 | 'Y' 21 | 22 | # start an explicit transaction. 23 | 'P' "S3" "BEGIN" 0 24 | 'B' "" "S3" 0 0 0 25 | 'E' "" 0 26 | 'S' 27 | 'Y' 28 | 29 | # INSERT one more row without bind message. 30 | 'B' "" "S1" 0 0 0 31 | 'E' "" 1 32 | 'S' 33 | 'Y' 34 | 35 | # commit the transaction. 36 | 'P' "S4" "COMMIT" 0 37 | 'B' "" "S4" 0 0 0 38 | 'E' "" 0 39 | 'S' 40 | 'Y' 41 | 42 | # This should return 2 rows if query cache validation succeeds. 43 | 'B' "" "S2" 0 0 0 44 | 'E' "" 0 45 | 'S' 46 | 'Y' 47 | 48 | # drop the test table. 49 | 'Q' "DROP TABLE regress_test" 50 | 'Y' 51 | 52 | 'X' 53 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/revoke2.data: -------------------------------------------------------------------------------- 1 | # Testing REVOKE is executed on another session case 2 | # Make sure to create cache (sync needed) 3 | 'P' "" "SELECT * FROM t1" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | 'P' "" "SELECT * FROM t1" 9 | 'B' "" "" 0 0 0 10 | 'E' "" 0 11 | 'S' 12 | 'Y' 13 | # execute REVOKE 14 | 'P' "" "REVOKE SELECT ON t1 FROM foo" 15 | 'B' "" "" 0 0 0 16 | 'E' "" 0 17 | 'S' 18 | 'Y' 19 | 'X' 20 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/revoke3.data: -------------------------------------------------------------------------------- 1 | # Testing REVOKE is executed on another session case 2 | # Make sure this does not access cache 3 | 'P' "" "SELECT * FROM t1" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'S' 7 | 'Y' 8 | 'X' 9 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/row_security.data: -------------------------------------------------------------------------------- 1 | # run SELECT as foo. It is expected 0 row returned. 2 | 'P' "" "SET ROLE TO foo" 3 | 'B' "" "" 0 0 0 4 | 'E' "" 0 5 | 'S' 6 | 'Y' 7 | 'P' "" "SELECT * FROM users WHERE user_name = 'bar'" 8 | 'B' "" "" 0 0 0 9 | 'E' "" 0 10 | 'S' 11 | 'Y' 12 | 'P' "" "RESET ROLE" 13 | 'B' "" "" 0 0 0 14 | 'E' "" 0 15 | 'S' 16 | 'Y' 17 | # run SELECT as bar. It is expected 0 row returned. 18 | 'P' "" "SET ROLE TO bar" 19 | 'B' "" "" 0 0 0 20 | 'E' "" 0 21 | 'S' 22 | 'Y' 23 | 'P' "" "SELECT * FROM users WHERE user_name = 'foo'" 24 | 'B' "" "" 0 0 0 25 | 'E' "" 0 26 | 'S' 27 | 'Y' 28 | # 29 | # testing row security with row_security = off 30 | # Error expected 31 | # 32 | 'P' "" "SET row_security TO off" 33 | 'B' "" "" 0 0 0 34 | 'E' "" 0 35 | 'S' 36 | 'Y' 37 | 'P' "" "SELECT * FROM users" 38 | 'B' "" "" 0 0 0 39 | 'E' "" 0 40 | 'S' 41 | 'Y' 42 | 'X' 43 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/session_authorization.data: -------------------------------------------------------------------------------- 1 | # create query cache 2 | 'P' "" "SELECT * FROM footable" 3 | 'B' "" "" 0 0 0 4 | 'E' "" 0 5 | 'S' 6 | 'Y' 7 | # SET SESSION_AUTHORIZATION 8 | 'P' "" "SET SESSION AUTHORIZATION bar" 9 | 'B' "" "" 0 0 0 10 | 'E' "" 0 11 | 'S' 12 | 'Y' 13 | # run SELECT as bar. Permission denied is expected. 14 | 'P' "" "SELECT * FROM footable" 15 | 'B' "" "" 0 0 0 16 | 'E' "" 0 17 | 'S' 18 | 'Y' 19 | 'X' 20 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/set_role1.data: -------------------------------------------------------------------------------- 1 | # create query cache 2 | 'P' "" "SELECT * FROM footable" 3 | 'B' "" "" 0 0 0 4 | 'E' "" 0 5 | 'S' 6 | 'Y' 7 | # SET ROLE 8 | 'P' "" "SET ROLE TO bar" 9 | 'B' "" "" 0 0 0 10 | 'E' "" 0 11 | 'S' 12 | 'Y' 13 | # run SELECT as bar. Permission denied is expected. 14 | 'P' "" "SELECT * FROM footable" 15 | 'B' "" "" 0 0 0 16 | 'E' "" 0 17 | 'S' 18 | 'Y' 19 | 'X' 20 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/set_role2.data: -------------------------------------------------------------------------------- 1 | # create query cache 2 | 'P' "" "SELECT * FROM footable" 3 | 'B' "" "" 0 0 0 4 | 'E' "" 0 5 | 'S' 6 | 'Y' 7 | # SET ROLE 8 | 'P' "" "SET ROLE TO foo" 9 | 'B' "" "" 0 0 0 10 | 'E' "" 0 11 | 'S' 12 | 'Y' 13 | # run SELECT as foo to make sure that cache is not used. 14 | # If query cache was created we will NOT see 15 | # "NOTICE: DB node id: 1 statement: SELECT ..." 16 | 'P' "" "SELECT * FROM footable" 17 | 'B' "" "" 0 0 0 18 | 'E' "" 0 19 | 'S' 20 | 'Y' 21 | # Modify footable to see cache invalidation works even after SET ROLE. 22 | 'P' "" "UPDATE footable SET t = 'foo1' WHERE t = 'foo1'" 23 | 'B' "" "" 0 0 0 24 | 'E' "" 0 25 | 'S' 26 | 'Y' 27 | # restore ROLE 28 | 'P' "" "RESET ROLE" 29 | 'B' "" "" 0 0 0 30 | 'E' "" 0 31 | 'S' 32 | 'Y' 33 | # Make sure cache was invalidated. 34 | 'P' "" "SELECT * FROM footable" 35 | 'B' "" "" 0 0 0 36 | 'E' "" 0 37 | 'S' 38 | 'Y' 39 | 'X' 40 | -------------------------------------------------------------------------------- /src/test/regression/tests/006.memqcache/set_role3.data: -------------------------------------------------------------------------------- 1 | # explicit transaction case 2 | # create query cache 3 | 'P' "" "SELECT * FROM footable" 4 | 'B' "" "" 0 0 0 5 | 'E' "" 0 6 | 'P' "" "SELECT * FROM footable" 7 | 'B' "" "" 0 0 0 8 | 'E' "" 0 9 | 'S' 10 | 'Y' 11 | # change role 12 | 'P' "" "SET ROLE TO foo" 13 | 'B' "" "" 0 0 0 14 | 'E' "" 0 15 | 'S' 16 | 'Y' 17 | 'P' "" "BEGIN" 18 | 'B' "" "" 0 0 0 19 | 'E' "" 0 20 | 'S' 21 | 'Y' 22 | # run SELECT as foo to make sure that cache is not used. 23 | # If query cache was created we will NOT see 24 | # "NOTICE: DB node id: 1 statement: SELECT ..." 25 | 'P' "" "SELECT * FROM footable" 26 | 'B' "" "" 0 0 0 27 | 'E' "" 0 28 | 'S' 29 | 'Y' 30 | # Modify footable to see cache invalidation works even after SET ROLE. 31 | 'P' "" "INSERT INTO footable VALUES ('foo3')" 32 | 'B' "" "" 0 0 0 33 | 'E' "" 0 34 | 'S' 35 | 'Y' 36 | 'P' "" "END" 37 | 'B' "" "" 0 0 0 38 | 'E' "" 0 39 | 'S' 40 | 'Y' 41 | # undo the INSERT to not disturb subsequent tests 42 | 'Q' "DELETE FROM footable WHERE t = 'foo3'" 43 | 'Y' 44 | 'X' 45 | -------------------------------------------------------------------------------- /src/test/regression/tests/007.memqcache-memcached/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/007.memqcache-memcached/expected.txt: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/008.dbredirect/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/008.dbredirect/select.pgbench: -------------------------------------------------------------------------------- 1 | SELECT 'test16' 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/008.dbredirect/select1.pgbench: -------------------------------------------------------------------------------- 1 | SELECT 'test18' 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/009.sql_comments/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/expected.txt: -------------------------------------------------------------------------------- 1 | ./run-test parse_schedule 2 | testcase insert: OK 3 | testcase update: OK 4 | testcase misc: OK 5 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for unit test of rewriting timestamp queries. 4 | # requires Ruby 5 | 6 | cd timestamp 7 | make clean 8 | rm result.txt 9 | make 10 | make test > result.txt 11 | cmp ../expected.txt result.txt 12 | if [ $? != 0 ];then 13 | echo NG 14 | exit 1 15 | fi 16 | cd .. 17 | 18 | echo OK 19 | exit 0 20 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/.gitignore: -------------------------------------------------------------------------------- 1 | result.txt 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/Makefile: -------------------------------------------------------------------------------- 1 | PROGRAM=timestamp-test 2 | topsrc_dir=../../../../.. 3 | CPPFLAGS=-I$(topsrc_dir)/include -I$(shell $(PGBIN)/pg_config --includedir) 4 | CFLAGS=-Wall -O0 -g -std=gnu99 5 | CC=gcc 6 | 7 | OBJS=main.o \ 8 | $(topsrc_dir)/utils/strlcpy.o \ 9 | $(topsrc_dir)/utils/pgstrcasecmp.o \ 10 | $(topsrc_dir)/utils/psprintf.o \ 11 | $(topsrc_dir)/main/pool_globals.o \ 12 | $(topsrc_dir)/rewrite/pool_timestamp.o \ 13 | $(topsrc_dir)/parser/libsql-parser.a 14 | 15 | all: all-pre $(PROGRAM) 16 | 17 | all-pre: 18 | $(MAKE) -C $(topsrc_dir)/utils strlcpy.o 19 | $(MAKE) -C $(topsrc_dir)/utils pgstrcasecmp.o 20 | $(MAKE) -C $(topsrc_dir)/utils psprintf.o 21 | $(MAKE) -C $(topsrc_dir)/main pool_globals.o 22 | $(MAKE) -C $(topsrc_dir)/rewrite pool_timestamp.o 23 | $(MAKE) -C $(topsrc_dir)/parser 24 | 25 | $(PROGRAM): $(OBJS) 26 | $(CC) $(OBJS) -o $(PROGRAM) 27 | 28 | main.o: main.c 29 | 30 | test: $(PROGRAM) 31 | ./run-test parse_schedule 32 | 33 | clean: 34 | -rm *.o 35 | -rm $(PROGRAM) 36 | -rm result/*.out 37 | -rm result.txt 38 | -rm test.diff 39 | 40 | .PHONY: all all-pre test clean 41 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/expected/misc.out: -------------------------------------------------------------------------------- 1 | DELETE FROM "rel1" WHERE ("c1" = '2009-01-01 23:59:59.123456+09'::text::date ) 2 | PREPARE "q" ("date",timestamptz) AS DELETE FROM "rel1" WHERE ( ("c1" = $1 ) AND ("c3" = $2::text::date )) 3 | EXECUTE "q" ("pg_catalog"."timestamptz"('2009-01-01 23:59:59.123456+09'::text)) 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/expected/update.out: -------------------------------------------------------------------------------- 1 | UPDATE "rel1" SET "c1" = DEFAULT, "c2" = '2009-01-01 23:59:59.123456+09' 2 | UPDATE rel2 SET c1 = DEFAULT, c2 = DEFAULT 3 | UPDATE "rel1" SET "c1" = "pg_catalog"."timestamptz"('2009-01-01 23:59:59.123456+09'::text), "c2" = '2009-01-01 23:59:59.123456+09'::text::date 4 | UPDATE "rel1" SET ("c3", "c4") = ('2009-01-01 23:59:59.123456+09'::text::timestamptz,'2009-01-01 23:59:59.123456+09'::text::timetz) 5 | UPDATE "rel1" SET "c1" = '2009-01-01 23:59:59.123456+09'::text::timestamp, "c2" = '2009-01-01 23:59:59.123456+09'::text::time 6 | PREPARE "q" (int4,timestamptz) AS UPDATE "rel1" SET "c1" = $1, "c2" = $2::text::date 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/input/insert.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO rel1 DEFAULT VALUES 2 | INSERT INTO rel2 DEFAULT VALUES 3 | INSERT INTO rel2(c1) VALUES(1) 4 | INSERT INTO rel1 VALUES(1, now(), 2, CURRENT_DATE) 5 | INSERT INTO rel1 VALUES(3, CURRENT_TIMESTAMP, 4, CURRENT_TIME) 6 | INSERT INTO rel1 VALUES(5, CURRENT_TIMESTAMP(0), 6, CURRENT_TIME(0)) 7 | INSERT INTO rel1 VALUES(7, LOCALTIMESTAMP, 8, LOCALTIME) 8 | INSERT INTO rel1 VALUES(9, LOCALTIMESTAMP(0), 10, LOCALTIME(0)) 9 | INSERT INTO rel1 VALUES(11, DEFAULT); 10 | INSERT INTO rel1(c3) VALUES(1) 11 | INSERT INTO rel1(c2, c1) VALUES('2000-1-1', 1) 12 | INSERT INTO rel1(c2, c1) VALUES(DEFAULT, 2) 13 | INSERT INTO rel1(c2, c1) VALUES(DEFAULT, 3), (DEFAULT, 4), ('2009-1-1', 5) 14 | INSERT INTO rel1(c1, c2, c4) VALUES(1, '2009-1-1', '2009-2-2') 15 | PREPARE q AS INSERT INTO rel1(c3) VALUES(1) 16 | PREPARE q(int) AS INSERT INTO rel1(c3) VALUES($1) 17 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/input/misc.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM rel1 WHERE c1 = CURRENT_DATE 2 | PREPARE q(date) AS DELETE FROM rel1 WHERE c1 = $1 AND c3 = CURRENT_DATE 3 | EXECUTE q(now()) 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/input/update.sql: -------------------------------------------------------------------------------- 1 | UPDATE rel1 SET c1 = DEFAULT, c2 = DEFAULT 2 | UPDATE rel2 SET c1 = DEFAULT, c2 = DEFAULT 3 | UPDATE rel1 SET c1 = now(), c2 = CURRENT_DATE 4 | UPDATE rel1 SET (c3, c4) = (CURRENT_TIMESTAMP, CURRENT_TIME) 5 | UPDATE rel1 SET c1 = LOCALTIMESTAMP, c2 = LOCALTIME 6 | PREPARE q(int) AS UPDATE rel1 SET c1 = $1, c2 = CURRENT_DATE 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/parse_schedule: -------------------------------------------------------------------------------- 1 | insert 2 | update 3 | misc 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/010.rewrite_timestamp/timestamp/run-test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgpool/pgpool2/f0d0abb4c596c821fb81d8f47e12da75a89cb3fe/src/test/regression/tests/010.rewrite_timestamp/timestamp/run-test -------------------------------------------------------------------------------- /src/test/regression/tests/011.watchdog_quorum_failover/.gitignore: -------------------------------------------------------------------------------- 1 | leader/ 2 | standby/ 3 | standby2/ 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/011.watchdog_quorum_failover/leader.conf: -------------------------------------------------------------------------------- 1 | # leader watchdog 2 | use_watchdog = on 3 | wd_interval = 1 4 | wd_priority = 5 5 | 6 | hostname0 = 'localhost' 7 | wd_port0 = 21004 8 | pgpool_port0 = 11000 9 | hostname1 = 'localhost' 10 | wd_port1 = 21104 11 | pgpool_port1 = 11100 12 | hostname2 = 'localhost' 13 | wd_port2 = 21204 14 | pgpool_port2 = 11200 15 | 16 | heartbeat_hostname0 = 'localhost' 17 | heartbeat_port0 = 21005 18 | heartbeat_hostname1 = 'localhost' 19 | heartbeat_port1 = 21105 20 | heartbeat_hostname2 = 'localhost' 21 | heartbeat_port2 = 21205 22 | -------------------------------------------------------------------------------- /src/test/regression/tests/011.watchdog_quorum_failover/standby.conf: -------------------------------------------------------------------------------- 1 | # standby watchdog 2 | port = 11100 3 | pcp_port = 11105 4 | use_watchdog = on 5 | wd_interval = 1 6 | wd_priority = 3 7 | 8 | hostname0 = 'localhost' 9 | wd_port0 = 21004 10 | pgpool_port0 = 11000 11 | hostname1 = 'localhost' 12 | wd_port1 = 21104 13 | pgpool_port1 = 11100 14 | hostname2 = 'localhost' 15 | wd_port2 = 21204 16 | pgpool_port2 = 11200 17 | 18 | heartbeat_hostname0 = 'localhost' 19 | heartbeat_port0 = 21005 20 | heartbeat_hostname1 = 'localhost' 21 | heartbeat_port1 = 21105 22 | heartbeat_hostname2 = 'localhost' 23 | heartbeat_port2 = 21205 24 | -------------------------------------------------------------------------------- /src/test/regression/tests/011.watchdog_quorum_failover/standby2.conf: -------------------------------------------------------------------------------- 1 | # standby2 watchdog 2 | port = 11200 3 | pcp_port = 11205 4 | use_watchdog = on 5 | wd_interval = 1 6 | wd_priority = 1 7 | 8 | hostname0 = 'localhost' 9 | wd_port0 = 21004 10 | pgpool_port0 = 11000 11 | hostname1 = 'localhost' 12 | wd_port1 = 21104 13 | pgpool_port1 = 11100 14 | hostname2 = 'localhost' 15 | wd_port2 = 21204 16 | pgpool_port2 = 11200 17 | 18 | heartbeat_hostname0 = 'localhost' 19 | heartbeat_port0 = 21005 20 | heartbeat_hostname1 = 'localhost' 21 | heartbeat_port1 = 21105 22 | heartbeat_hostname2 = 'localhost' 23 | heartbeat_port2 = 21205 24 | -------------------------------------------------------------------------------- /src/test/regression/tests/012.watchdog_failover_when_quorum_exists/.gitignore: -------------------------------------------------------------------------------- 1 | leader/ 2 | standby/ 3 | standby2/ 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/012.watchdog_failover_when_quorum_exists/leader.conf: -------------------------------------------------------------------------------- 1 | # leader watchdog 2 | num_init_children = 4 3 | use_watchdog = on 4 | failover_when_quorum_exists = true 5 | failover_require_consensus = false 6 | allow_multiple_failover_requests_from_node = false 7 | wd_interval = 1 8 | wd_priority = 5 9 | 10 | hostname0 = 'localhost' 11 | wd_port0 = 21004 12 | pgpool_port0 = 11000 13 | hostname1 = 'localhost' 14 | wd_port1 = 21104 15 | pgpool_port1 = 11100 16 | hostname2 = 'localhost' 17 | wd_port2 = 21204 18 | pgpool_port2 = 11200 19 | 20 | heartbeat_hostname0 = 'localhost' 21 | heartbeat_port0 = 21005 22 | heartbeat_hostname1 = 'localhost' 23 | heartbeat_port1 = 21105 24 | heartbeat_hostname2 = 'localhost' 25 | heartbeat_port2 = 21205 26 | -------------------------------------------------------------------------------- /src/test/regression/tests/012.watchdog_failover_when_quorum_exists/standby.conf: -------------------------------------------------------------------------------- 1 | # standby watchdog 2 | num_init_children = 4 3 | port = 11100 4 | pcp_port = 11105 5 | use_watchdog = on 6 | failover_when_quorum_exists = true 7 | failover_require_consensus = false 8 | allow_multiple_failover_requests_from_node = false 9 | wd_interval = 1 10 | wd_priority = 3 11 | 12 | hostname0 = 'localhost' 13 | wd_port0 = 21004 14 | pgpool_port0 = 11000 15 | hostname1 = 'localhost' 16 | wd_port1 = 21104 17 | pgpool_port1 = 11100 18 | hostname2 = 'localhost' 19 | wd_port2 = 21204 20 | pgpool_port2 = 11200 21 | 22 | heartbeat_hostname0 = 'localhost' 23 | heartbeat_port0 = 21005 24 | heartbeat_hostname1 = 'localhost' 25 | heartbeat_port1 = 21105 26 | heartbeat_hostname2 = 'localhost' 27 | heartbeat_port2 = 21205 28 | -------------------------------------------------------------------------------- /src/test/regression/tests/012.watchdog_failover_when_quorum_exists/standby2.conf: -------------------------------------------------------------------------------- 1 | # standby2 watchdog 2 | num_init_children = 4 3 | port = 11200 4 | pcp_port = 11205 5 | use_watchdog = on 6 | failover_when_quorum_exists = true 7 | failover_require_consensus = false 8 | allow_multiple_failover_requests_from_node = false 9 | wd_interval = 1 10 | wd_priority = 1 11 | 12 | hostname0 = 'localhost' 13 | wd_port0 = 21004 14 | pgpool_port0 = 11000 15 | hostname1 = 'localhost' 16 | wd_port1 = 21104 17 | pgpool_port1 = 11100 18 | hostname2 = 'localhost' 19 | wd_port2 = 21204 20 | pgpool_port2 = 11200 21 | 22 | heartbeat_hostname0 = 'localhost' 23 | heartbeat_port0 = 21005 24 | heartbeat_hostname1 = 'localhost' 25 | heartbeat_port1 = 21105 26 | heartbeat_hostname2 = 'localhost' 27 | heartbeat_port2 = 21205 28 | -------------------------------------------------------------------------------- /src/test/regression/tests/013.watchdog_failover_require_consensus/.gitignore: -------------------------------------------------------------------------------- 1 | leader/ 2 | standby/ 3 | standby2/ 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/013.watchdog_failover_require_consensus/leader.conf: -------------------------------------------------------------------------------- 1 | # leader watchdog 2 | num_init_children = 4 3 | use_watchdog = on 4 | failover_when_quorum_exists = true 5 | failover_require_consensus = true 6 | allow_multiple_failover_requests_from_node = false 7 | wd_interval = 1 8 | wd_priority = 5 9 | 10 | hostname0 = 'localhost' 11 | wd_port0 = 21004 12 | pgpool_port0 = 11000 13 | hostname1 = 'localhost' 14 | wd_port1 = 21104 15 | pgpool_port1 = 11100 16 | hostname2 = 'localhost' 17 | wd_port2 = 21204 18 | pgpool_port2 = 11200 19 | 20 | heartbeat_hostname0 = 'localhost' 21 | heartbeat_port0 = 21005 22 | heartbeat_hostname1 = 'localhost' 23 | heartbeat_port1 = 21105 24 | heartbeat_hostname2 = 'localhost' 25 | heartbeat_port2 = 21205 26 | -------------------------------------------------------------------------------- /src/test/regression/tests/013.watchdog_failover_require_consensus/standby.conf: -------------------------------------------------------------------------------- 1 | # standby watchdog 2 | num_init_children = 4 3 | port = 11100 4 | pcp_port = 11105 5 | use_watchdog = on 6 | failover_when_quorum_exists = true 7 | failover_require_consensus = true 8 | allow_multiple_failover_requests_from_node = false 9 | wd_interval = 1 10 | wd_priority = 3 11 | 12 | hostname0 = 'localhost' 13 | wd_port0 = 21004 14 | pgpool_port0 = 11000 15 | hostname1 = 'localhost' 16 | wd_port1 = 21104 17 | pgpool_port1 = 11100 18 | hostname2 = 'localhost' 19 | wd_port2 = 21204 20 | pgpool_port2 = 11200 21 | 22 | heartbeat_hostname0 = 'localhost' 23 | heartbeat_port0 = 21005 24 | heartbeat_hostname1 = 'localhost' 25 | heartbeat_port1 = 21105 26 | heartbeat_hostname2 = 'localhost' 27 | heartbeat_port2 = 21205 28 | -------------------------------------------------------------------------------- /src/test/regression/tests/013.watchdog_failover_require_consensus/standby2.conf: -------------------------------------------------------------------------------- 1 | # standby2 watchdog 2 | num_init_children = 4 3 | port = 11200 4 | pcp_port = 11205 5 | use_watchdog = on 6 | failover_when_quorum_exists = true 7 | failover_require_consensus = true 8 | allow_multiple_failover_requests_from_node = false 9 | wd_interval = 1 10 | wd_priority = 1 11 | 12 | hostname0 = 'localhost' 13 | wd_port0 = 21004 14 | pgpool_port0 = 11000 15 | hostname1 = 'localhost' 16 | wd_port1 = 21104 17 | pgpool_port1 = 11100 18 | hostname2 = 'localhost' 19 | wd_port2 = 21204 20 | pgpool_port2 = 11200 21 | 22 | heartbeat_hostname0 = 'localhost' 23 | heartbeat_port0 = 21005 24 | heartbeat_hostname1 = 'localhost' 25 | heartbeat_port1 = 21105 26 | heartbeat_hostname2 = 'localhost' 27 | heartbeat_port2 = 21205 28 | -------------------------------------------------------------------------------- /src/test/regression/tests/014.watchdog_test_quorum_bypass/.gitignore: -------------------------------------------------------------------------------- 1 | leader/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/014.watchdog_test_quorum_bypass/leader.conf: -------------------------------------------------------------------------------- 1 | # leader watchdog 2 | num_init_children = 4 3 | use_watchdog = on 4 | failover_when_quorum_exists = true 5 | failover_require_consensus = true 6 | allow_multiple_failover_requests_from_node = false 7 | wd_interval = 1 8 | wd_priority = 5 9 | 10 | hostname0 = 'localhost' 11 | wd_port0 = 21004 12 | pgpool_port0 = 11000 13 | hostname1 = 'localhost' 14 | wd_port1 = 21104 15 | pgpool_port1 = 11100 16 | hostname2 = 'localhost' 17 | wd_port2 = 21204 18 | pgpool_port2 = 11200 19 | 20 | heartbeat_hostname0 = 'localhost' 21 | heartbeat_port0 = 21005 22 | heartbeat_hostname1 = 'localhost' 23 | heartbeat_port1 = 21105 24 | heartbeat_hostname2 = 'localhost' 25 | heartbeat_port2 = 21205 26 | -------------------------------------------------------------------------------- /src/test/regression/tests/015.watchdog_master_and_backend_fail/.gitignore: -------------------------------------------------------------------------------- 1 | leader/ 2 | standby/ 3 | standby2/ 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/015.watchdog_master_and_backend_fail/leader.conf: -------------------------------------------------------------------------------- 1 | # leader watchdog 2 | num_init_children = 4 3 | use_watchdog = on 4 | failover_when_quorum_exists = true 5 | failover_require_consensus = true 6 | allow_multiple_failover_requests_from_node = false 7 | wd_interval = 1 8 | wd_priority = 5 9 | 10 | hostname0 = 'localhost' 11 | wd_port0 = 21004 12 | pgpool_port0 = 11000 13 | hostname1 = 'localhost' 14 | wd_port1 = 21104 15 | pgpool_port1 = 11100 16 | hostname2 = 'localhost' 17 | wd_port2 = 21204 18 | pgpool_port2 = 11200 19 | 20 | heartbeat_hostname0 = 'localhost' 21 | heartbeat_port0 = 21005 22 | heartbeat_hostname1 = 'localhost' 23 | heartbeat_port1 = 21105 24 | heartbeat_hostname2 = 'localhost' 25 | heartbeat_port2 = 21205 26 | -------------------------------------------------------------------------------- /src/test/regression/tests/015.watchdog_master_and_backend_fail/standby.conf: -------------------------------------------------------------------------------- 1 | # standby watchdog 2 | num_init_children = 4 3 | port = 11100 4 | pcp_port = 11105 5 | use_watchdog = on 6 | failover_when_quorum_exists = true 7 | failover_require_consensus = true 8 | allow_multiple_failover_requests_from_node = false 9 | wd_interval = 1 10 | wd_priority = 3 11 | 12 | hostname0 = 'localhost' 13 | wd_port0 = 21004 14 | pgpool_port0 = 11000 15 | hostname1 = 'localhost' 16 | wd_port1 = 21104 17 | pgpool_port1 = 11100 18 | hostname2 = 'localhost' 19 | wd_port2 = 21204 20 | pgpool_port2 = 11200 21 | 22 | heartbeat_hostname0 = 'localhost' 23 | heartbeat_port0 = 21005 24 | heartbeat_hostname1 = 'localhost' 25 | heartbeat_port1 = 21105 26 | heartbeat_hostname2 = 'localhost' 27 | heartbeat_port2 = 21205 28 | -------------------------------------------------------------------------------- /src/test/regression/tests/015.watchdog_master_and_backend_fail/standby2.conf: -------------------------------------------------------------------------------- 1 | # standby2 watchdog 2 | num_init_children = 4 3 | port = 11200 4 | pcp_port = 11205 5 | use_watchdog = on 6 | failover_when_quorum_exists = true 7 | failover_require_consensus = true 8 | allow_multiple_failover_requests_from_node = false 9 | wd_interval = 1 10 | wd_priority = 1 11 | 12 | hostname0 = 'localhost' 13 | wd_port0 = 21004 14 | pgpool_port0 = 11000 15 | hostname1 = 'localhost' 16 | wd_port1 = 21104 17 | pgpool_port1 = 11100 18 | hostname2 = 'localhost' 19 | wd_port2 = 21204 20 | pgpool_port2 = 11200 21 | 22 | heartbeat_hostname0 = 'localhost' 23 | heartbeat_port0 = 21005 24 | heartbeat_hostname1 = 'localhost' 25 | heartbeat_port1 = 21105 26 | heartbeat_hostname2 = 'localhost' 27 | heartbeat_port2 = 21205 28 | -------------------------------------------------------------------------------- /src/test/regression/tests/016.node_0_is_not_primary/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/017.node_0_is_down/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/018.detach_primary/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/019.log_client_messages/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/019.log_client_messages/tests/copy.data: -------------------------------------------------------------------------------- 1 | # Test for copy protocol 2 | 3 | # create test table 4 | 'Q' "CREATE TABLE t1(a text)" 5 | 'Y' 6 | 7 | # CopyIn 8 | # 9 | 'Q' "COPY t1 FROM STDIN" 10 | # CopyData 11 | 'd' "abc" 12 | # CopyDone 13 | 'c' 14 | 'Y' 15 | 16 | # CopyOut 17 | # 18 | 'Q' "COPY t1 TO STDOUT" 19 | 'Y' 20 | 21 | # 22 | # Copy fail case 23 | # 24 | 'Q' "COPY t1 FROM STDIN" 25 | # CopyData 26 | 'd' "abc" 27 | # CopyFail 28 | 'f' "pgproto copy fail test" 29 | 'Y' 30 | 'X' 31 | -------------------------------------------------------------------------------- /src/test/regression/tests/019.log_client_messages/tests/describe.data: -------------------------------------------------------------------------------- 1 | # Test for Describe Flush command protocol 2 | 3 | # SELECT 1 FROM pgbench_accounts 4 | 'P' "S4" "SELECT 1 FROM pgbench_accounts" 0 5 | 'B' "" "S4" 0 0 0 6 | 'D' 'S' "S4" 7 | 'E' "" 0 8 | 'H' 9 | 'y' 10 | 'S' 11 | 'Y' 12 | 'X' 13 | -------------------------------------------------------------------------------- /src/test/regression/tests/019.log_client_messages/tests/extended_query.data: -------------------------------------------------------------------------------- 1 | # Test for extended-query protocol 2 | 3 | # Start a transaction 4 | 'P' "S1" "BEGIN" 0 5 | 'B' "" "S1" 0 0 0 6 | 'E' "" 0 7 | 'C' 'S' "S1" 8 | 9 | # Issue SELECT 10 | 'P' "S2" "SELECT 1 FROM pgbench_accounts" 0 11 | 'B' "P1" "S2" 0 0 0 12 | 'E' "P1" 50000 13 | 'C' 'S' "S2" 14 | # Issue COMMIT 15 | 'P' "S3" "COMMIT" 0 16 | 'B' "" "S3" 0 0 0 17 | 'E' "" 0 18 | 'C' 'S' "S3" 19 | 'S' 20 | 'Y' 21 | 'X' 22 | -------------------------------------------------------------------------------- /src/test/regression/tests/019.log_client_messages/tests/function.data: -------------------------------------------------------------------------------- 1 | # Test for FunctionCall protocol 2 | 3 | # 4 | # Test data example 5 | # 6 | 7 | # Function call (lo_creat) 8 | # from PostgreSQL's src/include/catalog/pg_proc.data 9 | # { oid => '957', descr => 'large object create', 10 | # proname => 'lo_creat', provolatile => 'v', proparallel => 'u', 11 | # prorettype => 'oid', proargtypes => 'int4', prosrc => 'be_lo_creat' }, 12 | 13 | 'F' 957 1 0 1 1 "0" 0 14 | 'Y' 15 | 'X' 16 | -------------------------------------------------------------------------------- /src/test/regression/tests/019.log_client_messages/tests/simple.data: -------------------------------------------------------------------------------- 1 | # Test for simple-query protocol 'Q' 2 | 'Q' "SELECT * FROM pgbench_accounts LIMIT 1" 3 | 'Y' 4 | 'X' 5 | -------------------------------------------------------------------------------- /src/test/regression/tests/023.ssl_connection/README: -------------------------------------------------------------------------------- 1 | The sample server.key and server.crt was created by using following commands: 2 | 3 | openssl req -new -text -out server.req 4 | openssl rsa -in privkey.pem -out server.key 5 | rm privkey.pem 6 | openssl req -x509 -days 3650 -in server.req -text -key server.key -out server.crt 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/026.temp_table/temp_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE t1(i int); 2 | INSERT INTO T1 VALUES(1); 3 | CREATE TEMP TABLE t1(i int); 4 | SELECT * FROM t1; -- should return 0 row 5 | DROP TABLE t1; 6 | SELECT * FROM t1; -- should return 1 row 7 | 8 | BEGIN; 9 | CREATE TEMP TABLE t1(i int); 10 | SELECT * FROM t1; -- should return 0 row 11 | DROP TABLE t1; 12 | SELECT * FROM t1; -- should return 1 row 13 | END; 14 | 15 | BEGIN; 16 | CREATE TEMP TABLE t1(i int); 17 | SELECT * FROM t1; -- should return 0 row 18 | aaa; 19 | ABORT; 20 | 21 | SELECT * FROM t1; -- should return 1 row 22 | 23 | CREATE TEMP TABLE t1(i int); 24 | CREATE TEMP TABLE t2(i int); 25 | CREATE TEMP TABLE t3(i int); 26 | SELECT * FROM t1; -- should return 0 row 27 | DROP TABLE t1, t2, t3; 28 | SELECT * FROM t1; -- should return 1 row 29 | 30 | BEGIN; 31 | CREATE TEMP TABLE t1(i int); 32 | CREATE TEMP TABLE t2(i int); 33 | CREATE TEMP TABLE t3(i int); 34 | SELECT * FROM t1; -- should return 0 row 35 | DROP TABLE t1, t2, t3; 36 | SELECT * FROM t1; -- should return 1 row 37 | END; 38 | 39 | DROP TABLE t1; 40 | -------------------------------------------------------------------------------- /src/test/regression/tests/026.temp_table/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for temporary table tracing. 4 | 5 | WHOAMI=`whoami` 6 | source $TESTLIBS 7 | TESTDIR=testdir 8 | PSQL=$PGBIN/psql 9 | 10 | rm -fr $TESTDIR 11 | mkdir $TESTDIR 12 | cd $TESTDIR 13 | 14 | # create test environment 15 | echo -n "creating test environment..." 16 | $PGPOOL_SETUP -n 2 || exit 1 17 | echo "done." 18 | 19 | source ./bashrc.ports 20 | export PGPORT=$PGPOOL_PORT 21 | ./startall 22 | wait_for_pgpool_startup 23 | 24 | # test1: default (check_temp_table = catalog) 25 | 26 | $PSQL -a -f ../temp_table.sql test > results.txt 27 | 28 | cmp results.txt ../expected.txt || exit 1 29 | 30 | # test2: trace 31 | 32 | echo "check_temp_table = trace" >> etc/pgpool.conf 33 | 34 | ./pgpool_reload 35 | 36 | $PSQL -a -f ../temp_table.sql test > results.txt 37 | 38 | cmp results.txt ../expected.txt || exit 1 39 | 40 | ./shutdownall 41 | 42 | exit 0 43 | -------------------------------------------------------------------------------- /src/test/regression/tests/027.auto_failback/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/029.cert_passphrase/cert.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Create root cert 4 | openssl req -new -x509 -nodes -out root.crt -keyout root.key -days 365 -subj /CN=MyRootCA 5 | # PostgreSQL/Pgpool cert with password 6 | openssl genrsa -aes256 -out server.key -passout pass:pgpoolsecret 2048 7 | openssl req -new -out server.req -key server.key -subj "/CN=postgresql" -passin pass:pgpoolsecret 8 | openssl x509 -req -in server.req -CAkey root.key -CA root.crt -days 365 -CAcreateserial -out server.crt 9 | # Frontend Cert 10 | openssl req -new -out postgresql.req -keyout frontend.key -nodes -subj "/CN=$USER" 11 | openssl x509 -req -in postgresql.req -CAkey root.key -CA root.crt -days 365 -CAcreateserial -out frontend.crt 12 | -------------------------------------------------------------------------------- /src/test/regression/tests/030.snapshot_isolation/expected.txt: -------------------------------------------------------------------------------- 1 | count 2 | ------- 3 | 1 4 | (1 row) 5 | 6 | VACUUM 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/030.snapshot_isolation/inconsistency1.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | UPDATE t1 SET i = i + 1; 3 | END; 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/030.snapshot_isolation/inconsistency2.sql: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | INSERT INTO log SELECT * FROM t1; 3 | END; 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/039.log_backend_messages/pgproto.data: -------------------------------------------------------------------------------- 1 | 'P' "" "SELECT * FROM t1" 0 2 | 'B' "" "" 0 0 0 3 | 'E' "" 0 4 | 'S' 5 | 'Y' 6 | 'X' 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/040.client_auth/create_ldap_user.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/bash 2 | # Create input file for ldapadd command to stdout. 3 | # Users' list must be provided from stdin. 4 | if [ $# -ne 0 ];then 5 | echo "usage: $0" 6 | exit 1 7 | fi 8 | 9 | while read username 10 | do 11 | cat <> $USERS 17 | done 18 | -------------------------------------------------------------------------------- /src/test/regression/tests/040.client_auth/del_ldap_users.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/bash 2 | # read users list from stdin and perform ldapdelete command. 3 | PASSWORD=ldapadmin 4 | set -e 5 | while read i 6 | do 7 | ldapdelete -x -w $PASSWORD -D cn=admin,dc=nodomain uid=$i,ou=people,dc=nodomain 8 | done 9 | -------------------------------------------------------------------------------- /src/test/regression/tests/040.client_auth/del_pam_users.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/bash 2 | # read users list from stdin and perform userdel command. 3 | set -e 4 | while read i 5 | do 6 | /usr/sbin/userdel $i 7 | done 8 | -------------------------------------------------------------------------------- /src/test/regression/tests/040.client_auth/list_ldap_user.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/bash 2 | # List up user names used in the LDAP authentication test. 3 | # The result is put to stdout. 4 | spec=client_auth_2node.csv 5 | IFS="," 6 | cat $spec|while read line 7 | do 8 | set $line 9 | if [ $1 != 'username' ];then 10 | username=$1 11 | pool_hba=$2 12 | pg_hba=$5 13 | if [ $pool_hba = "ldap" -o $pg_hba = "ldap" ];then 14 | echo $username 15 | fi 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /src/test/regression/tests/040.client_auth/list_pam_user.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/bash 2 | # List up user names used in the PAM authentication test. 3 | spec=client_auth_2node.csv 4 | IFS="," 5 | cat $spec|while read line 6 | do 7 | set $line 8 | if [ $1 != 'username' ];then 9 | username=$1 10 | pool_hba=$2 11 | pg_hba=$5 12 | if [ $pool_hba = "pam" -o $pg_hba = "pam" ];then 13 | echo $username 14 | fi 15 | fi 16 | done 17 | -------------------------------------------------------------------------------- /src/test/regression/tests/040.client_auth/pam_users.txt: -------------------------------------------------------------------------------- 1 | scram4 2 | scram9 3 | scram14 4 | scram19 5 | md54 6 | md59 7 | md514 8 | md519 9 | p4 10 | p9 11 | p14 12 | p19 13 | o4 14 | o9 15 | o14 16 | o19 17 | o24 18 | pam1 19 | pam2 20 | pam3 21 | pam4 22 | pam5 23 | pam6 24 | pam7 25 | pam8 26 | pam9 27 | pam10 28 | pam11 29 | pam12 30 | pam13 31 | pam14 32 | pam15 33 | pam16 34 | pam17 35 | pam18 36 | pam19 37 | pam20 38 | ldap4 39 | ldap9 40 | ldap14 41 | ldap19 42 | -------------------------------------------------------------------------------- /src/test/regression/tests/050.bug58/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/051.bug60/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/051.bug60/bug.sql: -------------------------------------------------------------------------------- 1 | -- This script shows the problem. When run in a psql connected to 2 | -- pgpool with one primary and one read-only replica, this will cause 3 | -- the pgpool process to exit because the exception found in the 4 | -- commit (in the primary node) does not match the success code for the 5 | -- commit in the read-only replica. 6 | 7 | -- The expected behavior would be to continue execution normally 8 | -- without dropping the connection. 9 | 10 | begin; 11 | insert into my_table ( col1 ) values ( 'ouch' ); 12 | commit; 13 | -------------------------------------------------------------------------------- /src/test/regression/tests/051.bug60/database-clean.sql: -------------------------------------------------------------------------------- 1 | -- This is -*- sql -*- code that removes the test data from the 2 | -- database, to leave things as clean as we found them. 3 | 4 | drop trigger t1 on my_table; 5 | drop function p1(); 6 | drop table my_table; 7 | -------------------------------------------------------------------------------- /src/test/regression/tests/051.bug60/database-setup.sql: -------------------------------------------------------------------------------- 1 | -- This is a simple -*- sql -*- file that sets up a simple table to 2 | -- which inserts cannot happen. This is enforced by a deferred 3 | -- trigger, which allows for the easy reproduction of an issue 4 | -- observed with commit raises an exception. 5 | 6 | create table my_table ( 7 | col1 text not null primary key 8 | ); 9 | 10 | -- The p1() function simply takes the place of a trigger that would 11 | -- perform semantic or integrity validations that must occur at the 12 | -- end of the transaction. In our case, it simply raises an exception 13 | -- (ie, always fails). 14 | 15 | create function p1() returns trigger as 16 | $$ 17 | begin 18 | raise exception 'some integrity violation'; 19 | end; 20 | $$ 21 | language plpgsql; 22 | 23 | -- A simple delayed constraint that insures that the p1() function is 24 | -- invoked at the commit stage. 25 | 26 | create constraint trigger t1 after insert on my_table 27 | deferrable initially deferred 28 | for each row execute procedure p1(); 29 | -------------------------------------------------------------------------------- /src/test/regression/tests/052.do_query/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/052.do_query/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for do_query. 4 | # 5 | # If do_query failed while executing in extended query mode, pgpool hangs. 6 | # precondition to trigger the error: remove pgpool_regclass.so or some such. 7 | # 8 | BUG="do_query" 9 | WHOAMI=`whoami` 10 | source $TESTLIBS 11 | TESTDIR=testdir 12 | PGBENCH=$PGBENCH_PATH 13 | 14 | rm -fr $TESTDIR 15 | mkdir $TESTDIR 16 | cd $TESTDIR 17 | 18 | # create test environment 19 | echo -n "creating test environment..." 20 | $PGPOOL_SETUP -m s -n 1 --no-stop|| exit 1 21 | echo "done." 22 | 23 | source ./bashrc.ports 24 | 25 | #./startall 26 | 27 | export PGPORT=$PGPOOL_PORT 28 | 29 | wait_for_pgpool_startup 30 | 31 | echo "SELECT 1" > select.pgbench 32 | $PGBENCH -i test 33 | 34 | # run test. This will hung if the bug is remained. 35 | ($PGBENCH -c 10 -t 10 -M extended -f select.pgbench test)& 36 | sleep 5 37 | kill $! 38 | 39 | if [ $? = 0 ];then 40 | ./shutdownall 41 | exit 1 42 | fi 43 | 44 | ./shutdownall 45 | -------------------------------------------------------------------------------- /src/test/regression/tests/053.insert_lock_hangs/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/054.postgres_fdw/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/055.backend_all_down/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/056.bug63/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/057.bug61/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/058.bug68/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/059.bug92/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/059.bug92/jdbctest.java: -------------------------------------------------------------------------------- 1 | import java.sql.*; 2 | import javax.sql.*; 3 | import java.util.*; 4 | import java.io.*; 5 | 6 | public class jdbctest { 7 | public static void main(String[] args) { 8 | try { 9 | 10 | Properties prop = new Properties(); 11 | prop.load(new FileInputStream("jdbctest.prop")); 12 | String url = prop.getProperty("jdbc.url"); 13 | String user = prop.getProperty("jdbc.user"); 14 | String pwd = prop.getProperty("jdbc.password"); 15 | 16 | Connection conn = DriverManager.getConnection(url, user, pwd); 17 | conn.setAutoCommit(true); 18 | 19 | String sql = "INSERT INTO t VALUES ('1', 'a', 'X');"; 20 | Statement pst = conn.createStatement(); 21 | pst.executeUpdate(sql); 22 | pst.close(); 23 | conn.close(); 24 | 25 | } catch (Exception e) { 26 | System.err.println("jdbctest: ERROR: " + e); 27 | System.exit(1); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/regression/tests/060.memory_leak/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/061.cancel_query/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/061.cancel_query/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # Testing cancel query. 4 | # [pgpool-hackers: 694] pgpool-II 3.4 can't cancel query 5 | 6 | PSQL=$PGBIN/psql 7 | 8 | source $TESTLIBS 9 | TESTDIR=testdir 10 | 11 | rm -fr $TESTDIR 12 | mkdir $TESTDIR 13 | cd $TESTDIR 14 | 15 | # create test environment 16 | echo -n "creating test environment..." 17 | $PGPOOL_SETUP -m n -n 1 || exit 1 18 | echo "done." 19 | 20 | source ./bashrc.ports 21 | 22 | export PGPORT=$PGPOOL_PORT 23 | 24 | # start pgpool-II 25 | ./startall 26 | 27 | sleep 1 28 | 29 | # executing long running query 30 | $PSQL -c "select pg_sleep(10000);" test & 31 | 32 | # get psql process pid 33 | psqlpid=$! 34 | 35 | sleep 2 36 | 37 | # send CtrlC to psql to cancel the query 38 | kill -INT $psqlpid 39 | 40 | sleep 2 41 | 42 | RESULT=`ps -p $psqlpid | grep psql` 43 | 44 | ./shutdownall 45 | 46 | if [ -z "$RESULT" ]; then 47 | echo -n "test passed." 48 | exit 0 49 | fi 50 | 51 | echo -n "test failed. psql process still exists" 52 | echo -n "$RESULT" 53 | 54 | exit 1 55 | -------------------------------------------------------------------------------- /src/test/regression/tests/062.select_error_hangs/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/063.tables_with_space/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/064.bug153/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/065.bug152/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/065.bug152/run.sh: -------------------------------------------------------------------------------- 1 | export CLASSPATH=.:$JDBC_DRIVER 2 | javac Main.java 3 | java Main 4 | -------------------------------------------------------------------------------- /src/test/regression/tests/065.bug152/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # Test script for bug reported in bug#152 4 | # In memory query cache fails in extended query protocol. 5 | 6 | source $TESTLIBS 7 | TESTDIR=testdir 8 | PSQL=$PGBIN/psql 9 | export CLASSPATH=.:$JDBC_DRIVER 10 | 11 | for mode in s r 12 | do 13 | rm -fr $TESTDIR 14 | mkdir $TESTDIR 15 | cd $TESTDIR 16 | 17 | # create test environment 18 | echo -n "creating test environment..." 19 | $PGPOOL_SETUP -m $mode -n 1 || exit 1 20 | echo "done." 21 | 22 | source ./bashrc.ports 23 | 24 | echo "memory_cache_enabled = on" >> etc/pgpool.conf 25 | echo "log_client_messages = on" >> etc/pgpool.conf 26 | 27 | ./startall 28 | 29 | export PGPORT=$PGPOOL_PORT 30 | 31 | wait_for_pgpool_startup 32 | 33 | cp ../run.sh . 34 | cp ../Main.java . 35 | 36 | sh run.sh 37 | 38 | if [ $? != 0 ];then 39 | ./shutdownall 40 | exit 1 41 | fi 42 | ./shutdownall 43 | 44 | cd .. 45 | done 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /src/test/regression/tests/066.bug230/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/066.bug230/Sample.java: -------------------------------------------------------------------------------- 1 | import java.io.PrintWriter; 2 | import java.sql.Connection; 3 | import java.sql.DriverManager; 4 | import java.sql.ResultSet; 5 | import java.sql.Statement; 6 | import java.util.Properties; 7 | 8 | import org.postgresql.Driver; 9 | 10 | public class Sample { 11 | public Sample() { 12 | } 13 | 14 | public static void main(String[] args) throws Exception { 15 | Properties props = new Properties(); 16 | props.setProperty("user", System.getenv("USER")); 17 | props.setProperty("password", ""); 18 | DriverManager.setLogWriter(new PrintWriter(System.out)); 19 | // Driver.setLogLevel(2); 20 | Connection conn = DriverManager.getConnection( 21 | "jdbc:postgresql://localhost:11000/test", props); 22 | conn.setAutoCommit(false); 23 | Statement st = conn.createStatement(); 24 | st.setFetchSize(100); 25 | ResultSet rs = st.executeQuery("SELECT * from GENERATE_SERIES(1,1000)"); 26 | while (rs.next()) { 27 | System.out.println(rs.getString(1)); 28 | } 29 | rs.close(); 30 | conn.close(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/regression/tests/066.bug230/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for for bug 230 (pgpool does not return result set if 4 | # the statement fetchSize is smaller than the result row count.) 5 | # 6 | source $TESTLIBS 7 | TESTDIR=testdir 8 | PSQL=$PGBIN/psql 9 | export CLASSPATH=.:$JDBC_DRIVER 10 | 11 | for mode in s r n 12 | do 13 | echo "===== mode:$mode =====" 14 | rm -fr $TESTDIR 15 | mkdir $TESTDIR 16 | cd $TESTDIR 17 | 18 | # create test environment 19 | echo -n "creating test environment..." 20 | 21 | # to avoid replication lag problem when testing under streaming 22 | # replication mode, set number of cluster to 1 when in the mode 23 | if [ $mode = "s" ];then 24 | n=1 25 | else 26 | n=2 27 | fi 28 | 29 | $PGPOOL_SETUP -m $mode -n $n || exit 1 30 | echo "done." 31 | 32 | source ./bashrc.ports 33 | 34 | ./startall 35 | 36 | export PGPORT=$PGPOOL_PORT 37 | 38 | wait_for_pgpool_startup 39 | 40 | cp ../Sample.java . 41 | javac Sample.java 42 | java Sample > sample.log 2>&1 43 | if [ $? != 0 ];then 44 | ./shutdownall; exit 1; 45 | fi 46 | 47 | ./shutdownall 48 | 49 | cd .. 50 | 51 | done 52 | 53 | exit 0 54 | -------------------------------------------------------------------------------- /src/test/regression/tests/067.bug231/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/067.bug231/TestReplGap.java: -------------------------------------------------------------------------------- 1 | import java.sql.*; 2 | 3 | public class TestReplGap { 4 | 5 | public static void main(String[] args) throws SQLException, InterruptedException { 6 | 7 | try (Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:11000/test?loglevel=2", "t-ishii", "")) { 8 | 9 | conn.setAutoCommit(false); 10 | // Note: It is supposed that the database postgres contains table "t1". 11 | try (PreparedStatement stmt = conn.prepareStatement("select * from t1 where id = ? ")) { 12 | 13 | for (int i = 0; i < 100; i++) { 14 | stmt.setInt(1, i); 15 | stmt.executeQuery().close(); 16 | 17 | System.out.println(i); 18 | } 19 | } 20 | 21 | conn.commit(); 22 | conn.close(); 23 | 24 | System.out.println("DONE"); 25 | } catch (SQLException ex) { 26 | ex.printStackTrace(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/regression/tests/067.bug231/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for for bug 231 (packet kind of backend 1 ['3'] does not 4 | # match with main/majority nodes packet kind ['2']). 5 | # 6 | source $TESTLIBS 7 | TESTDIR=testdir 8 | PSQL=$PGBIN/psql 9 | export CLASSPATH=.:$JDBC_DRIVER 10 | 11 | rm -fr $TESTDIR 12 | mkdir $TESTDIR 13 | cd $TESTDIR 14 | 15 | # create test environment 16 | echo -n "creating test environment..." 17 | $PGPOOL_SETUP -m s -n 2 || exit 1 18 | echo "done." 19 | echo "backend_weight0 = 0" >> etc/pgpool.conf 20 | echo "backend_weight1 = 1" >> etc/pgpool.conf 21 | 22 | source ./bashrc.ports 23 | ./startall 24 | export PGPORT=$PGPOOL_PORT 25 | wait_for_pgpool_startup 26 | 27 | export PGPORT=11000 28 | $PSQL -c "DROP TABLE IF EXISTS t1" test 29 | $PSQL -c "CREATE TABLE t1 (id int);" test 30 | $PSQL -c "INSERT INTO t1 VALUES(1)" test 31 | 32 | TestProg=TestReplGap 33 | cp ../$TestProg.java . 34 | javac $TestProg.java 35 | java $TestProg > $TestProg.log 2>&1 36 | if [ $? != 0 ];then 37 | ./shutdownall; exit 1; 38 | fi 39 | ./shutdownall 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /src/test/regression/tests/068.memqcache_bug/.gitignore: -------------------------------------------------------------------------------- 1 | testdir/ 2 | -------------------------------------------------------------------------------- /src/test/regression/tests/068.memqcache_bug/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for a memqcache bug reported in pgpool-general-jp:1441. 4 | # (do_query() hangs in certain condition) 5 | # requires Java PostgreSQL JDBC driver. 6 | 7 | source $TESTLIBS 8 | WHOAMI=`whoami` 9 | TESTDIR=testdir 10 | PSQL=$PGBIN/psql 11 | export CLASSPATH=.:$JDBC_DRIVER 12 | 13 | rm -fr $TESTDIR 14 | mkdir $TESTDIR 15 | cd $TESTDIR 16 | 17 | # create test environment 18 | echo -n "creating test environment..." 19 | $PGPOOL_SETUP -m s -n 2 || exit 1 20 | echo "done." 21 | 22 | source ./bashrc.ports 23 | 24 | export PGPORT=$PGPOOL_PORT 25 | 26 | echo "jdbc.url=jdbc:postgresql://localhost:$PGPOOL_PORT/test" > javatest.prop 27 | echo "jdbc.user=$WHOAMI" >> javatest.prop 28 | echo "jdbc.password=" >> javatest.prop 29 | 30 | 31 | echo "memory_cache_enabled = on" >> etc/pgpool.conf 32 | sh startall 33 | wait_for_pgpool_startup 34 | 35 | cp ../Sample.java . 36 | $PSQL test <> etc/pgpool.conf 27 | sh startall 28 | wait_for_pgpool_startup 29 | 30 | $PGPROTO -d test -f ../extended_query_test.data # hang here if the bug bites you... 31 | sh shutdownall 32 | exit 0 33 | -------------------------------------------------------------------------------- /src/test/regression/tests/074.bug700_memqcache_segfault/expected.txt: -------------------------------------------------------------------------------- 1 | FE=> Query (query="SET statement_timeout TO 1000") 2 | <= BE CommandComplete(SET) 3 | <= BE ReadyForQuery(I) 4 | FE=> Parse(stmt="S1", query="SELECT 1") 5 | FE=> Bind(stmt="S1", portal="P1") 6 | FE=> Execute(portal="P1") 7 | FE=> Close(portal="P1") 8 | FE=> Bind(stmt="S1", portal="P2") 9 | FE=> Execute(portal="P2") 10 | FE=> Close(portal="P2") 11 | FE=> Sync 12 | <= BE ParseComplete 13 | <= BE BindComplete 14 | <= BE DataRow 15 | <= BE CommandComplete(SELECT 1) 16 | <= BE CloseComplete 17 | <= BE BindComplete 18 | <= BE DataRow 19 | <= BE CommandComplete(SELECT 1) 20 | <= BE CloseComplete 21 | <= BE ReadyForQuery(I) 22 | FE=> Terminate 23 | -------------------------------------------------------------------------------- /src/test/regression/tests/074.bug700_memqcache_segfault/pgproto.data: -------------------------------------------------------------------------------- 1 | 'Q' "SET statement_timeout TO 1000" 2 | 'Y' 3 | 'P' "S1" "SELECT 1" 0 4 | 'B' "P1" "S1" 0 0 0 5 | 'E' "P1" 0 6 | 'C' 'P' "P1" 7 | 'B' "P2" "S1" 0 0 0 8 | 'E' "P2" 0 9 | 'C' 'P' "P2" 10 | 'S' 11 | 'Y' 12 | 'X' 13 | -------------------------------------------------------------------------------- /src/test/regression/tests/074.bug700_memqcache_segfault/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for a memqcache bug 700. 4 | # 5 | # Pgpool-II crashes upon receiving CloseComplete. 6 | # This only happens in other than streaming and logical replication mode. 7 | 8 | source $TESTLIBS 9 | WHOAMI=`whoami` 10 | TESTDIR=testdir 11 | PGPROTO=$PGPOOL_INSTALL_DIR/bin/pgproto 12 | 13 | for mode in s i r n 14 | do 15 | rm -fr $TESTDIR 16 | mkdir $TESTDIR 17 | cd $TESTDIR 18 | 19 | # create test environment 20 | echo -n "creating test environment in mode = $mode..." 21 | $PGPOOL_SETUP -m $mode -n 1 || exit 1 22 | echo "done." 23 | 24 | source ./bashrc.ports 25 | 26 | export PGPORT=$PGPOOL_PORT 27 | 28 | echo "memory_cache_enabled = on" >> etc/pgpool.conf 29 | echo "log_min_messages = debug1" >> etc/pgpool.conf 30 | ./startall 31 | wait_for_pgpool_startup 32 | 33 | $PGPROTO -d test -f ../pgproto.data > result.txt 2>&1 34 | cmp ../expected.txt result.txt 35 | if [ $? != 0 ];then 36 | ./shutdownall 37 | exit 1 38 | fi 39 | ./shutdownall 40 | cd .. 41 | done 42 | 43 | exit 0 44 | -------------------------------------------------------------------------------- /src/test/regression/tests/076.copy_hang/pgproto.data: -------------------------------------------------------------------------------- 1 | 'Q' "CREATE TEMP TABLE t1(i INT)" 2 | 'Y' 3 | 'Q' "COPY t1 FROM STDIN" 0 4 | 'd' "1" 5 | 'H' 6 | 'c' 7 | 'S' 8 | 'Y' 9 | 'X' 10 | -------------------------------------------------------------------------------- /src/test/regression/tests/078.aborted_transaction/expected.txt: -------------------------------------------------------------------------------- 1 | BEGIN; 2 | BEGIN 3 | SELECT * FROM non_existing_table; 4 | ERROR: relation "non_existing_table" does not exist 5 | LINE 1: SELECT * FROM non_existing_table; 6 | ^ 7 | SELECT 1; 8 | ERROR: current transaction is aborted, commands ignored until end of transaction block 9 | DETAIL: statement: SELECT 1; 10 | END; 11 | ROLLBACK 12 | BEGIN; 13 | BEGIN 14 | aaa; 15 | ERROR: syntax error at or near "aaa" 16 | LINE 1: aaa; 17 | ^ 18 | SELECT 1; 19 | ERROR: current transaction is aborted, commands ignored until end of transaction block 20 | DETAIL: statement: SELECT 1; 21 | END; 22 | ROLLBACK 23 | SELECT 1; 24 | ?column? 25 | ---------- 26 | 1 27 | (1 row) 28 | 29 | BEGIN; 30 | BEGIN 31 | SAVEPOINT s1; 32 | SAVEPOINT 33 | aaa; 34 | ERROR: syntax error at or near "aaa" 35 | LINE 1: aaa; 36 | ^ 37 | ROLLBACK TO s1; 38 | ROLLBACK 39 | SELECT 1; 40 | ?column? 41 | ---------- 42 | 1 43 | (1 row) 44 | 45 | END; 46 | COMMIT 47 | -------------------------------------------------------------------------------- /src/test/regression/tests/078.aborted_transaction/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # test script for aborted transaction. 4 | 5 | source $TESTLIBS 6 | TESTDIR=testdir 7 | PSQL=$PGBIN/psql 8 | PG_CTL=$PGBIN/pg_ctl 9 | 10 | rm -fr $TESTDIR 11 | mkdir $TESTDIR 12 | cd $TESTDIR 13 | 14 | # create test environment 15 | echo -n "creating test environment..." 16 | $PGPOOL_SETUP || exit 1 17 | echo "done." 18 | echo "backend_weight1 = 0" >> etc/pgpool.conf 19 | 20 | source ./bashrc.ports 21 | export PGPORT=$PGPOOL_PORT 22 | 23 | ./startall 24 | wait_for_pgpool_startup 25 | 26 | $PSQL -e test > results.txt 2>&1 </dev/null 45 | then 46 | echo "test succeeded" 47 | else 48 | echo "test failed" 49 | diff -c ../expected.txt results.txt 50 | ./shutdownall 51 | exit 1 52 | fi 53 | ./shutdownall 54 | exit 0 55 | -------------------------------------------------------------------------------- /src/test/regression/tests/079.multi_prepare/expected.txt: -------------------------------------------------------------------------------- 1 | FE=> Query (query="PREPARE mark_rels_by_node(int8) AS SELECT $1;PREPARE mark_rels_by_way(int8) AS SELECT $1") 2 | <= BE CommandComplete(PREPARE) 3 | <= BE CommandComplete(PREPARE) 4 | <= BE ReadyForQuery(I) 5 | FE=> Bind(stmt="mark_rels_by_node", portal="") 6 | FE=> Describe(portal="") 7 | FE=> Execute(portal="") 8 | FE=> Sync 9 | <= BE BindComplete 10 | <= BE RowDescription 11 | <= BE DataRow 12 | <= BE CommandComplete(SELECT 1) 13 | <= BE ReadyForQuery(I) 14 | FE=> Bind(stmt="mark_rels_by_way", portal="") 15 | FE=> Describe(portal="") 16 | FE=> Execute(portal="") 17 | FE=> Sync 18 | <= BE BindComplete 19 | <= BE RowDescription 20 | <= BE DataRow 21 | <= BE CommandComplete(SELECT 1) 22 | <= BE ReadyForQuery(I) 23 | FE=> Terminate 24 | -------------------------------------------------------------------------------- /src/test/regression/tests/079.multi_prepare/pgproto.data: -------------------------------------------------------------------------------- 1 | 'Q' "PREPARE mark_rels_by_node(int8) AS SELECT $1;PREPARE mark_rels_by_way(int8) AS SELECT $1" 2 | 'Y' 3 | # portal statement_name num_format_code (0 is text) num_params param_length "param" 4 | # num_return_value_format_code return_value_format_code 5 | 'B' "" "mark_rels_by_node" 0 1 1 "2" 1 0 6 | 'D' 'P' "" 7 | 'E' "" 0 8 | 'S' 9 | 'Y' 10 | # error was: unable to bind D cannot get parse message "mark_rels_by_way" 11 | 'B' "" "mark_rels_by_way" 0 1 1 "1" 1 0 12 | 'D' 'P' "" 13 | 'E' "" 0 14 | 'S' 15 | 'Y' 16 | 'X' 17 | -------------------------------------------------------------------------------- /src/test/regression/tests/079.multi_prepare/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # Test script for multi statement query including PREPARE *and* bind is used later on. 4 | # Discussion: [pgpool-general: 8870] Prepared statements over pgpool ? 5 | # 6 | source $TESTLIBS 7 | TESTDIR=testdir 8 | PSQL=$PGBIN/psql 9 | PG_CTL=$PGBIN/pg_ctl 10 | PGPROTO=$PGPOOL_INSTALL_DIR/bin/pgproto 11 | export PGDATABASE=test 12 | 13 | #for mode in s 14 | for mode in s i r n 15 | do 16 | rm -fr $TESTDIR 17 | mkdir $TESTDIR 18 | cd $TESTDIR 19 | 20 | echo -n "creating test environment..." 21 | $PGPOOL_SETUP -m $mode || exit 1 22 | echo "done." 23 | source ./bashrc.ports 24 | ./startall 25 | wait_for_pgpool_startup 26 | 27 | $PGPROTO -d $PGDATABASE -p $PGPOOL_PORT -f ../pgproto.data > results.txt 2>&1 28 | cmp ../expected.txt results.txt 29 | 30 | if [ $? != 0 ];then 31 | echo "test failed in mode: $mode". 32 | ./shutdownall 33 | exit 1 34 | fi 35 | ./shutdownall 36 | cd .. 37 | done 38 | 39 | exit 0 40 | -------------------------------------------------------------------------------- /src/test/regression/tests/080.declare/expected.txt: -------------------------------------------------------------------------------- 1 | FE=> Query (query="BEGIN") 2 | <= BE CommandComplete(BEGIN) 3 | <= BE ReadyForQuery(T) 4 | FE=> Query (query="DECLARE "serverside-cursor-broken" CURSOR FOR SELECT 3") 5 | <= BE CommandComplete(DECLARE CURSOR) 6 | <= BE ReadyForQuery(T) 7 | FE=> Describe(portal="serverside-cursor-broken") 8 | FE=> Sync 9 | <= BE RowDescription 10 | <= BE ReadyForQuery(T) 11 | FE=> Query (query="END") 12 | <= BE CommandComplete(COMMIT) 13 | <= BE ReadyForQuery(I) 14 | FE=> Sync 15 | <= BE ReadyForQuery(I) 16 | FE=> Query (query="BEGIN") 17 | <= BE CommandComplete(BEGIN) 18 | <= BE ReadyForQuery(T) 19 | FE=> Parse(stmt="", query="DECLARE "serverside-cursor-broken" CURSOR FOR SELECT 3") 20 | FE=> Bind(stmt="", portal="") 21 | FE=> Execute(portal="") 22 | FE=> Describe(portal="serverside-cursor-broken") 23 | FE=> Sync 24 | <= BE ParseComplete 25 | <= BE BindComplete 26 | <= BE CommandComplete(DECLARE CURSOR) 27 | <= BE RowDescription 28 | <= BE ReadyForQuery(T) 29 | FE=> Query (query="END") 30 | <= BE CommandComplete(COMMIT) 31 | <= BE ReadyForQuery(I) 32 | FE=> Sync 33 | <= BE ReadyForQuery(I) 34 | FE=> Terminate 35 | -------------------------------------------------------------------------------- /src/test/regression/tests/080.declare/pgproto.data: -------------------------------------------------------------------------------- 1 | # test for simple query DECLARE 2 | 'Q' "BEGIN" 3 | 'Y' 4 | 'Q' "DECLARE "serverside-cursor-broken" CURSOR FOR SELECT 3" 5 | 'Y' 6 | # Describe message should return RowDescription without error 7 | 'D' 'P' "serverside-cursor-broken" 8 | 'S' 9 | 'Y' 10 | 'Q' "END" 11 | 'Y' 12 | 'S' 13 | 'Y' 14 | # test for extended query DECLARE 15 | 'Q' "BEGIN" 16 | 'Y' 17 | 'P' "" "DECLARE "serverside-cursor-broken" CURSOR FOR SELECT 3" 0 18 | 'B' "" "" 0 0 0 19 | 'E' "" 0 20 | # Describe message should return RowDescription without error 21 | 'D' 'P' "serverside-cursor-broken" 22 | 'S' 23 | 'Y' 24 | 'Q' "END" 25 | 'Y' 26 | 'S' 27 | 'Y' 28 | 'X' 29 | -------------------------------------------------------------------------------- /src/test/regression/tests/080.declare/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #------------------------------------------------------------------- 3 | # Test script for the case that Describe portal created by DECLARE 4 | # CUSOR causes FATAL error. 5 | # Discussion: [pgpool-general: 8934] DECLARE "serverside-cursor-broken" NO SCROLL CURSOR FOR SELECT 6 | # 7 | source $TESTLIBS 8 | TESTDIR=testdir 9 | PSQL=$PGBIN/psql 10 | PG_CTL=$PGBIN/pg_ctl 11 | PGPROTO=$PGPOOL_INSTALL_DIR/bin/pgproto 12 | export PGDATABASE=test 13 | 14 | for mode in s i r n 15 | do 16 | rm -fr $TESTDIR 17 | mkdir $TESTDIR 18 | cd $TESTDIR 19 | 20 | echo -n "creating test environment..." 21 | $PGPOOL_SETUP -m $mode || exit 1 22 | echo "done." 23 | source ./bashrc.ports 24 | ./startall 25 | wait_for_pgpool_startup 26 | 27 | $PGPROTO -d $PGDATABASE -p $PGPOOL_PORT -f ../pgproto.data > results.txt 2>&1 28 | cmp ../expected.txt results.txt 29 | 30 | if [ $? != 0 ];then 31 | echo "test failed in mode: $mode". 32 | ./shutdownall 33 | exit 1 34 | fi 35 | ./shutdownall 36 | cd .. 37 | done 38 | 39 | exit 0 40 | -------------------------------------------------------------------------------- /src/test/regression/tests/082.guard_against_bad_protocol/pgproto.data: -------------------------------------------------------------------------------- 1 | 'P' "" "BEGIN" 0 2 | 'B' "" "" 0 0 0 3 | 'E' "" 0 4 | 'Q' "SAVEPOINT PGJDBC_AUTOSAVE" 5 | 'Y' 6 | 'P' "" "SELECT 1" 0 7 | 'X' 8 | -------------------------------------------------------------------------------- /src/test/regression/tests/082.guard_against_bad_protocol/pgproto2.data: -------------------------------------------------------------------------------- 1 | 'P' "" "SELECT 1" 0 2 | 'B' "" "" 0 0 0 3 | 'E' "" 0 4 | 'X' 5 | -------------------------------------------------------------------------------- /src/tools/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | pgpool_setup 3 | watchdog_setup 4 | -------------------------------------------------------------------------------- /src/tools/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = pcp pgmd5 pgenc pgproto watchdog 2 | 3 | bin_SCRIPTS = pgpool_setup 4 | 5 | pgpool_setup: 6 | ln -s ../test/pgpool_setup . 7 | 8 | clean-local: 9 | -rm -f $(bin_SCRIPTS) 10 | -------------------------------------------------------------------------------- /src/tools/pcp/.gitignore: -------------------------------------------------------------------------------- 1 | pcp_attach_node 2 | pcp_detach_node 3 | pcp_health_check_stats 4 | pcp_invalidate_query_cache 5 | pcp_log_rotate 6 | pcp_node_count 7 | pcp_node_info 8 | pcp_pool_status 9 | pcp_proc_count 10 | pcp_proc_info 11 | pcp_promote_node 12 | pcp_recovery_node 13 | pcp_reload_config 14 | pcp_stop_pgpool 15 | pcp_watchdog_info 16 | -------------------------------------------------------------------------------- /src/tools/pgenc/.gitignore: -------------------------------------------------------------------------------- 1 | base64.c 2 | fe_memutils.c 3 | md5.c 4 | pg_enc 5 | pool_config.c 6 | pool_config_variables.c 7 | pool_globals.c 8 | pool_passwd.c 9 | pool_path.c 10 | pool_signal.c 11 | regex_array.c 12 | ssl_utils.c 13 | strlcpy.c 14 | -------------------------------------------------------------------------------- /src/tools/pgmd5/.gitignore: -------------------------------------------------------------------------------- 1 | fe_memutils.c 2 | md5.c 3 | pool_config.c 4 | pool_config_variables.c 5 | pool_globals.c 6 | pool_passwd.c 7 | pool_path.c 8 | pool_signal.c 9 | regex_array.c 10 | strlcpy.c 11 | pool_config.c 12 | -------------------------------------------------------------------------------- /src/tools/pgmd5/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -D_GNU_SOURCE -DPOOL_PRIVATE -I @PGSQL_INCLUDE_DIR@ 2 | bin_PROGRAMS = pg_md5 3 | 4 | dist_pg_md5_SOURCES = pg_md5.c \ 5 | ../fe_port.c 6 | nodist_pg_md5_SOURCES = md5.c \ 7 | pool_passwd.c \ 8 | strlcpy.c \ 9 | regex_array.c \ 10 | pool_config_variables.c \ 11 | pool_config.c \ 12 | fe_memutils.c \ 13 | pool_path.c 14 | 15 | DEFS = @DEFS@ \ 16 | -DDEFAULT_CONFIGDIR=\"$(sysconfdir)\" -DPOOL_TOOLS 17 | 18 | md5.c: ../../../src/auth/md5.c 19 | rm -f $@ && ln -s $< . 20 | md5.h: ../../../src/include/auth/md5.h 21 | rm -f $@ && ln -s $< . 22 | pool_passwd.c: ../../../src/auth/pool_passwd.c 23 | rm -f $@ && ln -s $< . 24 | pool_path.c: ../../../src/utils/pool_path.c 25 | rm -f $@ && ln -s $< . 26 | strlcpy.c: ../../../src/utils/strlcpy.c 27 | rm -f $@ && ln -s $< . 28 | regex_array.c: ../../../src/utils/regex_array.c 29 | rm -f $@ && ln -s $< . 30 | pool_config_variables.c: ../../../src/config/pool_config_variables.c 31 | rm -f $@ && ln -s $< . 32 | pool_config.c: ../../../src/config/pool_config.c 33 | rm -f $@ && ln -s $< . 34 | fe_memutils.c: ../../../src/tools/fe_memutils.c 35 | rm -f $@ && ln -s $< . 36 | 37 | clean-local: 38 | -rm -f $(nodist_pg_md5_SOURCES) 39 | -------------------------------------------------------------------------------- /src/tools/pgproto/.gitignore: -------------------------------------------------------------------------------- 1 | pgproto 2 | -------------------------------------------------------------------------------- /src/tools/pgproto/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -D_GNU_SOURCE -I @PGSQL_INCLUDE_DIR@ 2 | bin_PROGRAMS = pgproto 3 | 4 | pgproto_SOURCES = main.c read.c send.c extended_query.c buffer.c fe_memutils.c 5 | pgproto_LDADD = -L@PGSQL_LIB_DIR@ -lpq 6 | 7 | -------------------------------------------------------------------------------- /src/tools/watchdog/.gitignore: -------------------------------------------------------------------------------- 1 | fe_memutils.c 2 | json.c 3 | json_writer.c 4 | md5.c 5 | pool_config.c 6 | pool_config_variables.c 7 | pool_path.c 8 | psprintf.c 9 | regex_array.c 10 | socket_stream.c 11 | ssl_utils.c 12 | stringinfo.c 13 | strlcpy.c 14 | wd_commands.c 15 | wd_ipc_conn.c 16 | wd_cli 17 | -------------------------------------------------------------------------------- /src/utils/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | psqlscan.c 3 | pool_config.c 4 | -------------------------------------------------------------------------------- /src/utils/error/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/utils/mmgr/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/utils/pcp/.gitignore: -------------------------------------------------------------------------------- 1 | .dirstamp 2 | -------------------------------------------------------------------------------- /src/watchdog/Makefile.am: -------------------------------------------------------------------------------- 1 | top_builddir = ../.. 2 | AM_CPPFLAGS = -D_GNU_SOURCE -I @PGSQL_INCLUDE_DIR@ 3 | ARFLAGS = cr 4 | WATCHDOG_DEBUG=0 5 | noinst_LIBRARIES = lib-watchdog.a 6 | 7 | lib_watchdog_a_SOURCES = \ 8 | watchdog.c \ 9 | wd_if.c \ 10 | wd_lifecheck.c \ 11 | wd_commands.c \ 12 | wd_internal_commands.c \ 13 | wd_ipc_conn.c \ 14 | wd_json_data.c \ 15 | wd_ping.c \ 16 | wd_heartbeat.c \ 17 | wd_utils.c \ 18 | wd_escalation.c 19 | 20 | DEFS = @DEFS@ -DWATCHDOG_DEBUG_OPTS=$(WATCHDOG_DEBUG) 21 | --------------------------------------------------------------------------------