prestogres 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +20 -0
- data/LICENSE +202 -0
- data/NOTICE +22 -0
- data/README.md +217 -0
- data/Rakefile +13 -0
- data/VERSION +1 -0
- data/bin/prestogres +254 -0
- data/config/pcp.conf.sample +28 -0
- data/config/pgpool.conf +678 -0
- data/config/pool_hba.conf +84 -0
- data/config/pool_passwd +0 -0
- data/config/postgresql.conf +2 -0
- data/ext/.gitignore +6 -0
- data/ext/depend +26 -0
- data/ext/extconf.rb +4 -0
- data/ext/prestogres_config.c +12 -0
- data/pgpool2/.gitignore +36 -0
- data/pgpool2/AUTHORS +4 -0
- data/pgpool2/COPYING +12 -0
- data/pgpool2/ChangeLog +1 -0
- data/pgpool2/INSTALL +1 -0
- data/pgpool2/Makefile.am +159 -0
- data/pgpool2/Makefile.in +1187 -0
- data/pgpool2/NEWS +4960 -0
- data/pgpool2/README +1 -0
- data/pgpool2/README.euc_jp +1 -0
- data/pgpool2/README.online-recovery +62 -0
- data/pgpool2/TODO +103 -0
- data/pgpool2/ac_func_accept_argtypes.m4 +85 -0
- data/pgpool2/aclocal.m4 +1088 -0
- data/pgpool2/c-compiler.m4 +134 -0
- data/pgpool2/c-library.m4 +325 -0
- data/pgpool2/child.c +2097 -0
- data/pgpool2/config.guess +1532 -0
- data/pgpool2/config.h.in +332 -0
- data/pgpool2/config.sub +1640 -0
- data/pgpool2/configure +15752 -0
- data/pgpool2/configure.in +392 -0
- data/pgpool2/depcomp +522 -0
- data/pgpool2/doc/basebackup.sh +17 -0
- data/pgpool2/doc/pgpool-de.html +4220 -0
- data/pgpool2/doc/pgpool-en.html +5738 -0
- data/pgpool2/doc/pgpool-fr.html +4118 -0
- data/pgpool2/doc/pgpool-ja.css +198 -0
- data/pgpool2/doc/pgpool-ja.html +11279 -0
- data/pgpool2/doc/pgpool-zh_cn.html +4445 -0
- data/pgpool2/doc/pgpool.css +280 -0
- data/pgpool2/doc/pgpool_remote_start +13 -0
- data/pgpool2/doc/recovery.conf.sample +117 -0
- data/pgpool2/doc/tutorial-en.html +707 -0
- data/pgpool2/doc/tutorial-ja.html +422 -0
- data/pgpool2/doc/tutorial-memqcache-en.html +325 -0
- data/pgpool2/doc/tutorial-memqcache-ja.html +370 -0
- data/pgpool2/doc/tutorial-memqcache-zh_cn.html +322 -0
- data/pgpool2/doc/tutorial-watchdog-en.html +306 -0
- data/pgpool2/doc/tutorial-watchdog-ja.html +343 -0
- data/pgpool2/doc/tutorial-watchdog-zh_cn.html +301 -0
- data/pgpool2/doc/tutorial-zh_cn.html +537 -0
- data/pgpool2/doc/watchdog.png +0 -0
- data/pgpool2/doc/wd-en.html +236 -0
- data/pgpool2/doc/wd-en.jpg +0 -0
- data/pgpool2/doc/wd-ja.html +219 -0
- data/pgpool2/doc/wd-ja.jpg +0 -0
- data/pgpool2/doc/wd-zh_cn.html +201 -0
- data/pgpool2/doc/where_to_send_queries.odg +0 -0
- data/pgpool2/doc/where_to_send_queries.pdf +0 -0
- data/pgpool2/general.m4 +166 -0
- data/pgpool2/getopt_long.c +200 -0
- data/pgpool2/getopt_long.h +44 -0
- data/pgpool2/install-sh +251 -0
- data/pgpool2/ltmain.sh +8406 -0
- data/pgpool2/m4/libtool.m4 +7360 -0
- data/pgpool2/m4/ltoptions.m4 +368 -0
- data/pgpool2/m4/ltsugar.m4 +123 -0
- data/pgpool2/m4/ltversion.m4 +23 -0
- data/pgpool2/m4/lt~obsolete.m4 +92 -0
- data/pgpool2/main.c +2971 -0
- data/pgpool2/md5.c +444 -0
- data/pgpool2/md5.h +28 -0
- data/pgpool2/missing +360 -0
- data/pgpool2/mkinstalldirs +40 -0
- data/pgpool2/parser/Makefile.am +50 -0
- data/pgpool2/parser/Makefile.in +559 -0
- data/pgpool2/parser/copyfuncs.c +3310 -0
- data/pgpool2/parser/gram.c +39100 -0
- data/pgpool2/parser/gram.h +940 -0
- data/pgpool2/parser/gram.y +13408 -0
- data/pgpool2/parser/gramparse.h +74 -0
- data/pgpool2/parser/keywords.c +32 -0
- data/pgpool2/parser/keywords.h +39 -0
- data/pgpool2/parser/kwlist.h +425 -0
- data/pgpool2/parser/kwlookup.c +88 -0
- data/pgpool2/parser/list.c +1156 -0
- data/pgpool2/parser/makefuncs.c +518 -0
- data/pgpool2/parser/makefuncs.h +83 -0
- data/pgpool2/parser/memnodes.h +79 -0
- data/pgpool2/parser/nodes.c +29 -0
- data/pgpool2/parser/nodes.h +609 -0
- data/pgpool2/parser/outfuncs.c +5790 -0
- data/pgpool2/parser/parsenodes.h +2615 -0
- data/pgpool2/parser/parser.c +262 -0
- data/pgpool2/parser/parser.h +46 -0
- data/pgpool2/parser/pg_class.h +158 -0
- data/pgpool2/parser/pg_config_manual.h +273 -0
- data/pgpool2/parser/pg_list.h +352 -0
- data/pgpool2/parser/pg_trigger.h +147 -0
- data/pgpool2/parser/pg_wchar.h +492 -0
- data/pgpool2/parser/pool_memory.c +342 -0
- data/pgpool2/parser/pool_memory.h +77 -0
- data/pgpool2/parser/pool_parser.h +222 -0
- data/pgpool2/parser/pool_string.c +121 -0
- data/pgpool2/parser/pool_string.h +37 -0
- data/pgpool2/parser/primnodes.h +1280 -0
- data/pgpool2/parser/scan.c +4094 -0
- data/pgpool2/parser/scan.l +1451 -0
- data/pgpool2/parser/scanner.h +120 -0
- data/pgpool2/parser/scansup.c +221 -0
- data/pgpool2/parser/scansup.h +28 -0
- data/pgpool2/parser/snprintf.c +1102 -0
- data/pgpool2/parser/stringinfo.c +294 -0
- data/pgpool2/parser/stringinfo.h +178 -0
- data/pgpool2/parser/value.c +78 -0
- data/pgpool2/parser/value.h +62 -0
- data/pgpool2/parser/wchar.c +2048 -0
- data/pgpool2/pcp.conf.sample +28 -0
- data/pgpool2/pcp/Makefile.am +40 -0
- data/pgpool2/pcp/Makefile.in +771 -0
- data/pgpool2/pcp/libpcp_ext.h +250 -0
- data/pgpool2/pcp/md5.c +444 -0
- data/pgpool2/pcp/md5.h +28 -0
- data/pgpool2/pcp/pcp.c +1652 -0
- data/pgpool2/pcp/pcp.h +61 -0
- data/pgpool2/pcp/pcp_attach_node.c +172 -0
- data/pgpool2/pcp/pcp_detach_node.c +185 -0
- data/pgpool2/pcp/pcp_error.c +87 -0
- data/pgpool2/pcp/pcp_node_count.c +160 -0
- data/pgpool2/pcp/pcp_node_info.c +198 -0
- data/pgpool2/pcp/pcp_pool_status.c +166 -0
- data/pgpool2/pcp/pcp_proc_count.c +166 -0
- data/pgpool2/pcp/pcp_proc_info.c +261 -0
- data/pgpool2/pcp/pcp_promote_node.c +185 -0
- data/pgpool2/pcp/pcp_recovery_node.c +172 -0
- data/pgpool2/pcp/pcp_stop_pgpool.c +179 -0
- data/pgpool2/pcp/pcp_stream.c +385 -0
- data/pgpool2/pcp/pcp_stream.h +52 -0
- data/pgpool2/pcp/pcp_systemdb_info.c +194 -0
- data/pgpool2/pcp/pcp_watchdog_info.c +211 -0
- data/pgpool2/pcp_child.c +1493 -0
- data/pgpool2/pg_md5.c +305 -0
- data/pgpool2/pgpool.8.in +121 -0
- data/pgpool2/pgpool.conf +553 -0
- data/pgpool2/pgpool.conf.sample +666 -0
- data/pgpool2/pgpool.conf.sample-master-slave +665 -0
- data/pgpool2/pgpool.conf.sample-replication +664 -0
- data/pgpool2/pgpool.conf.sample-stream +664 -0
- data/pgpool2/pgpool.spec +264 -0
- data/pgpool2/pgpool_adm/TODO +7 -0
- data/pgpool2/pgpool_adm/pgpool_adm--1.0.sql +85 -0
- data/pgpool2/pgpool_adm/pgpool_adm.c +558 -0
- data/pgpool2/pgpool_adm/pgpool_adm.control +5 -0
- data/pgpool2/pgpool_adm/pgpool_adm.h +46 -0
- data/pgpool2/pgpool_adm/pgpool_adm.sql.in +85 -0
- data/pgpool2/pool.h +655 -0
- data/pgpool2/pool_auth.c +1390 -0
- data/pgpool2/pool_config.c +5007 -0
- data/pgpool2/pool_config.h +284 -0
- data/pgpool2/pool_config.l +3281 -0
- data/pgpool2/pool_config_md5.c +29 -0
- data/pgpool2/pool_connection_pool.c +812 -0
- data/pgpool2/pool_error.c +242 -0
- data/pgpool2/pool_globals.c +27 -0
- data/pgpool2/pool_hba.c +1723 -0
- data/pgpool2/pool_hba.conf.sample +67 -0
- data/pgpool2/pool_ip.c +567 -0
- data/pgpool2/pool_ip.h +65 -0
- data/pgpool2/pool_ipc.h +38 -0
- data/pgpool2/pool_lobj.c +242 -0
- data/pgpool2/pool_lobj.h +32 -0
- data/pgpool2/pool_memqcache.c +3818 -0
- data/pgpool2/pool_memqcache.h +268 -0
- data/pgpool2/pool_params.c +163 -0
- data/pgpool2/pool_passwd.c +249 -0
- data/pgpool2/pool_passwd.h +41 -0
- data/pgpool2/pool_path.c +193 -0
- data/pgpool2/pool_path.h +81 -0
- data/pgpool2/pool_process_context.c +247 -0
- data/pgpool2/pool_process_context.h +62 -0
- data/pgpool2/pool_process_query.c +5001 -0
- data/pgpool2/pool_process_reporting.c +1671 -0
- data/pgpool2/pool_process_reporting.h +44 -0
- data/pgpool2/pool_proto2.c +671 -0
- data/pgpool2/pool_proto_modules.c +3524 -0
- data/pgpool2/pool_proto_modules.h +185 -0
- data/pgpool2/pool_query_cache.c +1020 -0
- data/pgpool2/pool_query_context.c +1871 -0
- data/pgpool2/pool_query_context.h +105 -0
- data/pgpool2/pool_relcache.c +284 -0
- data/pgpool2/pool_relcache.h +78 -0
- data/pgpool2/pool_rewrite_outfuncs.c +9060 -0
- data/pgpool2/pool_rewrite_query.c +715 -0
- data/pgpool2/pool_rewrite_query.h +192 -0
- data/pgpool2/pool_select_walker.c +1150 -0
- data/pgpool2/pool_select_walker.h +68 -0
- data/pgpool2/pool_sema.c +161 -0
- data/pgpool2/pool_session_context.c +952 -0
- data/pgpool2/pool_session_context.h +203 -0
- data/pgpool2/pool_shmem.c +185 -0
- data/pgpool2/pool_signal.c +158 -0
- data/pgpool2/pool_signal.h +61 -0
- data/pgpool2/pool_ssl.c +339 -0
- data/pgpool2/pool_stream.c +962 -0
- data/pgpool2/pool_stream.h +61 -0
- data/pgpool2/pool_system.c +659 -0
- data/pgpool2/pool_timestamp.c +1215 -0
- data/pgpool2/pool_timestamp.h +38 -0
- data/pgpool2/pool_type.h +171 -0
- data/pgpool2/pool_worker_child.c +384 -0
- data/pgpool2/ps_status.c +404 -0
- data/pgpool2/recovery.c +435 -0
- data/pgpool2/redhat/pgpool.conf.sample.patch +52 -0
- data/pgpool2/redhat/pgpool.init +201 -0
- data/pgpool2/redhat/pgpool.sysconfig +7 -0
- data/pgpool2/redhat/rpm_installer/basebackup-replication.sh +53 -0
- data/pgpool2/redhat/rpm_installer/basebackup-stream.sh +55 -0
- data/pgpool2/redhat/rpm_installer/config_for_script +17 -0
- data/pgpool2/redhat/rpm_installer/failover.sh +64 -0
- data/pgpool2/redhat/rpm_installer/getsources.sh +141 -0
- data/pgpool2/redhat/rpm_installer/install.sh +1363 -0
- data/pgpool2/redhat/rpm_installer/pgpool_recovery_pitr +47 -0
- data/pgpool2/redhat/rpm_installer/pgpool_remote_start +15 -0
- data/pgpool2/redhat/rpm_installer/recovery.conf +4 -0
- data/pgpool2/redhat/rpm_installer/uninstall.sh +57 -0
- data/pgpool2/sample/dist_def_pgbench.sql +73 -0
- data/pgpool2/sample/pgpool.pam +3 -0
- data/pgpool2/sample/pgpool_recovery +20 -0
- data/pgpool2/sample/pgpool_recovery_pitr +19 -0
- data/pgpool2/sample/pgpool_remote_start +13 -0
- data/pgpool2/sample/replicate_def_pgbench.sql +18 -0
- data/pgpool2/sql/insert_lock.sql +15 -0
- data/pgpool2/sql/pgpool-recovery/pgpool-recovery.c +280 -0
- data/pgpool2/sql/pgpool-recovery/pgpool-recovery.sql.in +19 -0
- data/pgpool2/sql/pgpool-recovery/pgpool_recovery--1.0.sql +24 -0
- data/pgpool2/sql/pgpool-recovery/pgpool_recovery.control +5 -0
- data/pgpool2/sql/pgpool-recovery/uninstall_pgpool-recovery.sql +3 -0
- data/pgpool2/sql/pgpool-regclass/pgpool-regclass.c +206 -0
- data/pgpool2/sql/pgpool-regclass/pgpool-regclass.sql.in +4 -0
- data/pgpool2/sql/pgpool-regclass/pgpool_regclass--1.0.sql +7 -0
- data/pgpool2/sql/pgpool-regclass/pgpool_regclass.control +5 -0
- data/pgpool2/sql/pgpool-regclass/uninstall_pgpool-regclass.sql +1 -0
- data/pgpool2/sql/system_db.sql +38 -0
- data/pgpool2/strlcpy.c +85 -0
- data/pgpool2/test/C/test_extended.c +98 -0
- data/pgpool2/test/jdbc/.cvsignore +2 -0
- data/pgpool2/test/jdbc/AutoCommitTest.java +45 -0
- data/pgpool2/test/jdbc/BatchTest.java +55 -0
- data/pgpool2/test/jdbc/ColumnTest.java +60 -0
- data/pgpool2/test/jdbc/CreateTempTableTest.java +48 -0
- data/pgpool2/test/jdbc/InsertTest.java +34 -0
- data/pgpool2/test/jdbc/LockTest.java +36 -0
- data/pgpool2/test/jdbc/PgpoolTest.java +75 -0
- data/pgpool2/test/jdbc/README.euc_jp +73 -0
- data/pgpool2/test/jdbc/RunTest.java +83 -0
- data/pgpool2/test/jdbc/SelectTest.java +37 -0
- data/pgpool2/test/jdbc/UpdateTest.java +32 -0
- data/pgpool2/test/jdbc/expected/CreateTempTable +1 -0
- data/pgpool2/test/jdbc/expected/autocommit +10 -0
- data/pgpool2/test/jdbc/expected/batch +1 -0
- data/pgpool2/test/jdbc/expected/column +100 -0
- data/pgpool2/test/jdbc/expected/insert +1 -0
- data/pgpool2/test/jdbc/expected/lock +100 -0
- data/pgpool2/test/jdbc/expected/select +2 -0
- data/pgpool2/test/jdbc/expected/update +1 -0
- data/pgpool2/test/jdbc/pgpool.properties +7 -0
- data/pgpool2/test/jdbc/prepare.sql +54 -0
- data/pgpool2/test/jdbc/run.sh +6 -0
- data/pgpool2/test/parser/.cvsignore +6 -0
- data/pgpool2/test/parser/README +32 -0
- data/pgpool2/test/parser/expected/copy.out +17 -0
- data/pgpool2/test/parser/expected/create.out +64 -0
- data/pgpool2/test/parser/expected/cursor.out +37 -0
- data/pgpool2/test/parser/expected/delete.out +10 -0
- data/pgpool2/test/parser/expected/drop.out +12 -0
- data/pgpool2/test/parser/expected/insert.out +13 -0
- data/pgpool2/test/parser/expected/misc.out +28 -0
- data/pgpool2/test/parser/expected/prepare.out +4 -0
- data/pgpool2/test/parser/expected/privileges.out +31 -0
- data/pgpool2/test/parser/expected/scanner.out +30 -0
- data/pgpool2/test/parser/expected/select.out +89 -0
- data/pgpool2/test/parser/expected/transaction.out +38 -0
- data/pgpool2/test/parser/expected/update.out +11 -0
- data/pgpool2/test/parser/expected/v84.out +37 -0
- data/pgpool2/test/parser/expected/v90.out +25 -0
- data/pgpool2/test/parser/expected/var.out +22 -0
- data/pgpool2/test/parser/input/alter.sql +2 -0
- data/pgpool2/test/parser/input/copy.sql +17 -0
- data/pgpool2/test/parser/input/create.sql +64 -0
- data/pgpool2/test/parser/input/cursor.sql +37 -0
- data/pgpool2/test/parser/input/delete.sql +10 -0
- data/pgpool2/test/parser/input/drop.sql +12 -0
- data/pgpool2/test/parser/input/insert.sql +13 -0
- data/pgpool2/test/parser/input/misc.sql +28 -0
- data/pgpool2/test/parser/input/prepare.sql +4 -0
- data/pgpool2/test/parser/input/privileges.sql +31 -0
- data/pgpool2/test/parser/input/scanner.sql +34 -0
- data/pgpool2/test/parser/input/select.sql +89 -0
- data/pgpool2/test/parser/input/transaction.sql +38 -0
- data/pgpool2/test/parser/input/update.sql +11 -0
- data/pgpool2/test/parser/input/v84.sql +37 -0
- data/pgpool2/test/parser/input/v90.sql +38 -0
- data/pgpool2/test/parser/input/var.sql +22 -0
- data/pgpool2/test/parser/main.c +96 -0
- data/pgpool2/test/parser/parse_schedule +16 -0
- data/pgpool2/test/parser/pool.h +13 -0
- data/pgpool2/test/parser/run-test +62 -0
- data/pgpool2/test/pdo-test/README.euc_jp +58 -0
- data/pgpool2/test/pdo-test/SQLlist/test1.sql +3 -0
- data/pgpool2/test/pdo-test/SQLlist/test2.sql +3 -0
- data/pgpool2/test/pdo-test/collections.inc +11 -0
- data/pgpool2/test/pdo-test/def.inc +7 -0
- data/pgpool2/test/pdo-test/log.txt +0 -0
- data/pgpool2/test/pdo-test/mod/database.inc +36 -0
- data/pgpool2/test/pdo-test/mod/def.inc +0 -0
- data/pgpool2/test/pdo-test/mod/errorhandler.inc +27 -0
- data/pgpool2/test/pdo-test/pdotest.php +11 -0
- data/pgpool2/test/pdo-test/regsql.inc +56 -0
- data/pgpool2/test/pgpool_setup +898 -0
- data/pgpool2/test/regression/README +39 -0
- data/pgpool2/test/regression/clean.sh +21 -0
- data/pgpool2/test/regression/libs.sh +16 -0
- data/pgpool2/test/regression/regress.sh +166 -0
- data/pgpool2/test/regression/tests/001.load_balance/test.sh +128 -0
- data/pgpool2/test/regression/tests/002.native_replication/PgTester.java +47 -0
- data/pgpool2/test/regression/tests/002.native_replication/create.sql +6 -0
- data/pgpool2/test/regression/tests/002.native_replication/test.sh +71 -0
- data/pgpool2/test/regression/tests/003.failover/expected.r +6 -0
- data/pgpool2/test/regression/tests/003.failover/expected.s +6 -0
- data/pgpool2/test/regression/tests/003.failover/test.sh +45 -0
- data/pgpool2/test/regression/tests/004.watchdog/master.conf +12 -0
- data/pgpool2/test/regression/tests/004.watchdog/standby.conf +19 -0
- data/pgpool2/test/regression/tests/004.watchdog/test.sh +52 -0
- data/pgpool2/test/regression/tests/050.bug58/test.sh +50 -0
- data/pgpool2/test/regression/tests/051.bug60/bug.sql +12 -0
- data/pgpool2/test/regression/tests/051.bug60/database-clean.sql +6 -0
- data/pgpool2/test/regression/tests/051.bug60/database-setup.sql +28 -0
- data/pgpool2/test/regression/tests/051.bug60/test.sh +79 -0
- data/pgpool2/test/regression/tests/052.do_query/test.sh +44 -0
- data/pgpool2/test/regression/tests/053.insert_lock_hangs/test.sh +81 -0
- data/pgpool2/test/regression/tests/054.postgres_fdw/test.sh +67 -0
- data/pgpool2/test/regression/tests/055.backend_all_down/test.sh +52 -0
- data/pgpool2/test/regression/tests/056.bug63/jdbctest2.java +66 -0
- data/pgpool2/test/regression/tests/056.bug63/test.sh +47 -0
- data/pgpool2/test/regression/tests/057.bug61/test.sh +40 -0
- data/pgpool2/test/regression/tests/058.bug68/jdbctest3.java +45 -0
- data/pgpool2/test/regression/tests/058.bug68/test.sh +47 -0
- data/pgpool2/test/timestamp/expected/insert.out +16 -0
- data/pgpool2/test/timestamp/expected/misc.out +3 -0
- data/pgpool2/test/timestamp/expected/update.out +6 -0
- data/pgpool2/test/timestamp/input/insert.sql +16 -0
- data/pgpool2/test/timestamp/input/misc.sql +3 -0
- data/pgpool2/test/timestamp/input/update.sql +6 -0
- data/pgpool2/test/timestamp/main.c +129 -0
- data/pgpool2/test/timestamp/parse_schedule +3 -0
- data/pgpool2/test/timestamp/run-test +69 -0
- data/pgpool2/version.h +1 -0
- data/pgpool2/watchdog/Makefile.am +17 -0
- data/pgpool2/watchdog/Makefile.in +505 -0
- data/pgpool2/watchdog/test/stab.c +266 -0
- data/pgpool2/watchdog/test/test.c +85 -0
- data/pgpool2/watchdog/test/wd_child_t.c +87 -0
- data/pgpool2/watchdog/test/wd_lifecheck_t.c +87 -0
- data/pgpool2/watchdog/test/wd_packet_t.c +87 -0
- data/pgpool2/watchdog/test/wd_ping_t.c +20 -0
- data/pgpool2/watchdog/watchdog.c +408 -0
- data/pgpool2/watchdog/watchdog.h +209 -0
- data/pgpool2/watchdog/wd_child.c +444 -0
- data/pgpool2/watchdog/wd_ext.h +123 -0
- data/pgpool2/watchdog/wd_heartbeat.c +577 -0
- data/pgpool2/watchdog/wd_if.c +216 -0
- data/pgpool2/watchdog/wd_init.c +126 -0
- data/pgpool2/watchdog/wd_interlock.c +347 -0
- data/pgpool2/watchdog/wd_lifecheck.c +512 -0
- data/pgpool2/watchdog/wd_list.c +429 -0
- data/pgpool2/watchdog/wd_packet.c +1159 -0
- data/pgpool2/watchdog/wd_ping.c +330 -0
- data/pgpool2/ylwrap +223 -0
- data/pgsql/presto_client.py +346 -0
- data/pgsql/prestogres.py +156 -0
- data/pgsql/setup_functions.sql +21 -0
- data/pgsql/setup_language.sql +3 -0
- data/prestogres.gemspec +23 -0
- metadata +496 -0
@@ -0,0 +1,3310 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
*
|
3
|
+
* copyfuncs.c
|
4
|
+
* Copy functions for Postgres tree nodes.
|
5
|
+
*
|
6
|
+
* NOTE: we currently support copying all node types found in parse and
|
7
|
+
* plan trees. We do not support copying executor state trees; there
|
8
|
+
* is no need for that, and no point in maintaining all the code that
|
9
|
+
* would be needed. We also do not support copying Path trees, mainly
|
10
|
+
* because the circular linkages between RelOptInfo and Path nodes can't
|
11
|
+
* be handled easily in a simple depth-first traversal.
|
12
|
+
*
|
13
|
+
*
|
14
|
+
* Portions Copyright (c) 2003-2013, PgPool Global Development Group
|
15
|
+
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
16
|
+
* Portions Copyright (c) 1994, Regents of the University of California
|
17
|
+
*
|
18
|
+
* IDENTIFICATION
|
19
|
+
* src/backend/nodes/copyfuncs.c
|
20
|
+
*
|
21
|
+
*-------------------------------------------------------------------------
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include "pool.h"
|
25
|
+
|
26
|
+
#include <string.h>
|
27
|
+
#include <stddef.h>
|
28
|
+
#include "pool_memory.h"
|
29
|
+
#include "parsenodes.h"
|
30
|
+
|
31
|
+
|
32
|
+
/*
|
33
|
+
* Macros to simplify copying of different kinds of fields. Use these
|
34
|
+
* wherever possible to reduce the chance for silly typos. Note that these
|
35
|
+
* hard-wire the convention that the local variables in a Copy routine are
|
36
|
+
* named 'newnode' and 'from'.
|
37
|
+
*/
|
38
|
+
|
39
|
+
/* Copy a simple scalar field (int, float, bool, enum, etc) */
|
40
|
+
#define COPY_SCALAR_FIELD(fldname) \
|
41
|
+
(newnode->fldname = from->fldname)
|
42
|
+
|
43
|
+
/* Copy a field that is a pointer to some kind of Node or Node tree */
|
44
|
+
#define COPY_NODE_FIELD(fldname) \
|
45
|
+
(newnode->fldname = copyObject(from->fldname))
|
46
|
+
|
47
|
+
/* Copy a field that is a pointer to a Bitmapset */
|
48
|
+
#define COPY_BITMAPSET_FIELD(fldname) \
|
49
|
+
(newnode->fldname = bms_copy(from->fldname))
|
50
|
+
|
51
|
+
/* Copy a field that is a pointer to a C string, or perhaps NULL */
|
52
|
+
#define COPY_STRING_FIELD(fldname) \
|
53
|
+
(newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) NULL)
|
54
|
+
|
55
|
+
/* Copy a field that is a pointer to a simple palloc'd object of size sz */
|
56
|
+
#define COPY_POINTER_FIELD(fldname, sz) \
|
57
|
+
do { \
|
58
|
+
Size _size = (sz); \
|
59
|
+
newnode->fldname = palloc(_size); \
|
60
|
+
memcpy(newnode->fldname, from->fldname, _size); \
|
61
|
+
} while (0)
|
62
|
+
|
63
|
+
/* Copy a parse location field (for Copy, this is same as scalar case) */
|
64
|
+
#define COPY_LOCATION_FIELD(fldname) \
|
65
|
+
(newnode->fldname = from->fldname)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
/* ****************************************************************
|
70
|
+
* primnodes.h copy functions
|
71
|
+
* ****************************************************************
|
72
|
+
*/
|
73
|
+
|
74
|
+
/*
|
75
|
+
* _copyAlias
|
76
|
+
*/
|
77
|
+
static Alias *
|
78
|
+
_copyAlias(const Alias *from)
|
79
|
+
{
|
80
|
+
Alias *newnode = makeNode(Alias);
|
81
|
+
|
82
|
+
COPY_STRING_FIELD(aliasname);
|
83
|
+
COPY_NODE_FIELD(colnames);
|
84
|
+
|
85
|
+
return newnode;
|
86
|
+
}
|
87
|
+
|
88
|
+
/*
|
89
|
+
* _copyRangeVar
|
90
|
+
*/
|
91
|
+
static RangeVar *
|
92
|
+
_copyRangeVar(const RangeVar *from)
|
93
|
+
{
|
94
|
+
RangeVar *newnode = makeNode(RangeVar);
|
95
|
+
|
96
|
+
COPY_STRING_FIELD(catalogname);
|
97
|
+
COPY_STRING_FIELD(schemaname);
|
98
|
+
COPY_STRING_FIELD(relname);
|
99
|
+
COPY_SCALAR_FIELD(inhOpt);
|
100
|
+
COPY_SCALAR_FIELD(relpersistence);
|
101
|
+
COPY_NODE_FIELD(alias);
|
102
|
+
COPY_LOCATION_FIELD(location);
|
103
|
+
|
104
|
+
return newnode;
|
105
|
+
}
|
106
|
+
|
107
|
+
/*
|
108
|
+
* _copyIntoClause
|
109
|
+
*/
|
110
|
+
static IntoClause *
|
111
|
+
_copyIntoClause(const IntoClause *from)
|
112
|
+
{
|
113
|
+
IntoClause *newnode = makeNode(IntoClause);
|
114
|
+
|
115
|
+
COPY_NODE_FIELD(rel);
|
116
|
+
COPY_NODE_FIELD(colNames);
|
117
|
+
COPY_NODE_FIELD(options);
|
118
|
+
COPY_SCALAR_FIELD(onCommit);
|
119
|
+
COPY_STRING_FIELD(tableSpaceName);
|
120
|
+
COPY_SCALAR_FIELD(skipData);
|
121
|
+
|
122
|
+
return newnode;
|
123
|
+
}
|
124
|
+
|
125
|
+
/*
|
126
|
+
* We don't need a _copyExpr because Expr is an abstract supertype which
|
127
|
+
* should never actually get instantiated. Also, since it has no common
|
128
|
+
* fields except NodeTag, there's no need for a helper routine to factor
|
129
|
+
* out copying the common fields...
|
130
|
+
*/
|
131
|
+
|
132
|
+
/*
|
133
|
+
* _copyVar
|
134
|
+
*/
|
135
|
+
static Var *
|
136
|
+
_copyVar(const Var *from)
|
137
|
+
{
|
138
|
+
Var *newnode = makeNode(Var);
|
139
|
+
|
140
|
+
COPY_SCALAR_FIELD(varno);
|
141
|
+
COPY_SCALAR_FIELD(varattno);
|
142
|
+
COPY_SCALAR_FIELD(vartype);
|
143
|
+
COPY_SCALAR_FIELD(vartypmod);
|
144
|
+
COPY_SCALAR_FIELD(varcollid);
|
145
|
+
COPY_SCALAR_FIELD(varlevelsup);
|
146
|
+
COPY_SCALAR_FIELD(varnoold);
|
147
|
+
COPY_SCALAR_FIELD(varoattno);
|
148
|
+
COPY_LOCATION_FIELD(location);
|
149
|
+
|
150
|
+
return newnode;
|
151
|
+
}
|
152
|
+
|
153
|
+
/*
|
154
|
+
* _copyConst
|
155
|
+
*/
|
156
|
+
#if 0
|
157
|
+
static Const *
|
158
|
+
_copyConst(const Const *from)
|
159
|
+
{
|
160
|
+
Const *newnode = makeNode(Const);
|
161
|
+
|
162
|
+
COPY_SCALAR_FIELD(consttype);
|
163
|
+
COPY_SCALAR_FIELD(consttypmod);
|
164
|
+
COPY_SCALAR_FIELD(constcollid);
|
165
|
+
COPY_SCALAR_FIELD(constlen);
|
166
|
+
|
167
|
+
if (from->constbyval || from->constisnull)
|
168
|
+
{
|
169
|
+
/*
|
170
|
+
* passed by value so just copy the datum. Also, don't try to copy
|
171
|
+
* struct when value is null!
|
172
|
+
*/
|
173
|
+
newnode->constvalue = from->constvalue;
|
174
|
+
}
|
175
|
+
else
|
176
|
+
{
|
177
|
+
/*
|
178
|
+
* passed by reference. We need a palloc'd copy.
|
179
|
+
*/
|
180
|
+
newnode->constvalue = datumCopy(from->constvalue,
|
181
|
+
from->constbyval,
|
182
|
+
from->constlen);
|
183
|
+
}
|
184
|
+
|
185
|
+
COPY_SCALAR_FIELD(constisnull);
|
186
|
+
COPY_SCALAR_FIELD(constbyval);
|
187
|
+
|
188
|
+
return newnode;
|
189
|
+
}
|
190
|
+
#endif
|
191
|
+
|
192
|
+
/*
|
193
|
+
* _copyParam
|
194
|
+
*/
|
195
|
+
static Param *
|
196
|
+
_copyParam(const Param *from)
|
197
|
+
{
|
198
|
+
Param *newnode = makeNode(Param);
|
199
|
+
|
200
|
+
COPY_SCALAR_FIELD(paramkind);
|
201
|
+
COPY_SCALAR_FIELD(paramid);
|
202
|
+
COPY_SCALAR_FIELD(paramtype);
|
203
|
+
COPY_SCALAR_FIELD(paramtypmod);
|
204
|
+
COPY_SCALAR_FIELD(paramcollid);
|
205
|
+
COPY_LOCATION_FIELD(location);
|
206
|
+
|
207
|
+
return newnode;
|
208
|
+
}
|
209
|
+
|
210
|
+
/*
|
211
|
+
* _copyAggref
|
212
|
+
*/
|
213
|
+
static Aggref *
|
214
|
+
_copyAggref(const Aggref *from)
|
215
|
+
{
|
216
|
+
Aggref *newnode = makeNode(Aggref);
|
217
|
+
|
218
|
+
COPY_SCALAR_FIELD(aggfnoid);
|
219
|
+
COPY_SCALAR_FIELD(aggtype);
|
220
|
+
COPY_SCALAR_FIELD(aggcollid);
|
221
|
+
COPY_SCALAR_FIELD(inputcollid);
|
222
|
+
COPY_NODE_FIELD(args);
|
223
|
+
COPY_NODE_FIELD(aggorder);
|
224
|
+
COPY_NODE_FIELD(aggdistinct);
|
225
|
+
COPY_SCALAR_FIELD(aggstar);
|
226
|
+
COPY_SCALAR_FIELD(agglevelsup);
|
227
|
+
COPY_LOCATION_FIELD(location);
|
228
|
+
|
229
|
+
return newnode;
|
230
|
+
}
|
231
|
+
|
232
|
+
/*
|
233
|
+
* _copyWindowFunc
|
234
|
+
*/
|
235
|
+
static WindowFunc *
|
236
|
+
_copyWindowFunc(const WindowFunc *from)
|
237
|
+
{
|
238
|
+
WindowFunc *newnode = makeNode(WindowFunc);
|
239
|
+
|
240
|
+
COPY_SCALAR_FIELD(winfnoid);
|
241
|
+
COPY_SCALAR_FIELD(wintype);
|
242
|
+
COPY_SCALAR_FIELD(wincollid);
|
243
|
+
COPY_SCALAR_FIELD(inputcollid);
|
244
|
+
COPY_NODE_FIELD(args);
|
245
|
+
COPY_SCALAR_FIELD(winref);
|
246
|
+
COPY_SCALAR_FIELD(winstar);
|
247
|
+
COPY_SCALAR_FIELD(winagg);
|
248
|
+
COPY_LOCATION_FIELD(location);
|
249
|
+
|
250
|
+
return newnode;
|
251
|
+
}
|
252
|
+
|
253
|
+
/*
|
254
|
+
* _copyArrayRef
|
255
|
+
*/
|
256
|
+
static ArrayRef *
|
257
|
+
_copyArrayRef(const ArrayRef *from)
|
258
|
+
{
|
259
|
+
ArrayRef *newnode = makeNode(ArrayRef);
|
260
|
+
|
261
|
+
COPY_SCALAR_FIELD(refarraytype);
|
262
|
+
COPY_SCALAR_FIELD(refelemtype);
|
263
|
+
COPY_SCALAR_FIELD(reftypmod);
|
264
|
+
COPY_SCALAR_FIELD(refcollid);
|
265
|
+
COPY_NODE_FIELD(refupperindexpr);
|
266
|
+
COPY_NODE_FIELD(reflowerindexpr);
|
267
|
+
COPY_NODE_FIELD(refexpr);
|
268
|
+
COPY_NODE_FIELD(refassgnexpr);
|
269
|
+
|
270
|
+
return newnode;
|
271
|
+
}
|
272
|
+
|
273
|
+
/*
|
274
|
+
* _copyFuncExpr
|
275
|
+
*/
|
276
|
+
static FuncExpr *
|
277
|
+
_copyFuncExpr(const FuncExpr *from)
|
278
|
+
{
|
279
|
+
FuncExpr *newnode = makeNode(FuncExpr);
|
280
|
+
|
281
|
+
COPY_SCALAR_FIELD(funcid);
|
282
|
+
COPY_SCALAR_FIELD(funcresulttype);
|
283
|
+
COPY_SCALAR_FIELD(funcretset);
|
284
|
+
COPY_SCALAR_FIELD(funcformat);
|
285
|
+
COPY_SCALAR_FIELD(funccollid);
|
286
|
+
COPY_SCALAR_FIELD(inputcollid);
|
287
|
+
COPY_NODE_FIELD(args);
|
288
|
+
COPY_LOCATION_FIELD(location);
|
289
|
+
|
290
|
+
return newnode;
|
291
|
+
}
|
292
|
+
|
293
|
+
/*
|
294
|
+
* _copyNamedArgExpr *
|
295
|
+
*/
|
296
|
+
static NamedArgExpr *
|
297
|
+
_copyNamedArgExpr(const NamedArgExpr *from)
|
298
|
+
{
|
299
|
+
NamedArgExpr *newnode = makeNode(NamedArgExpr);
|
300
|
+
|
301
|
+
COPY_NODE_FIELD(arg);
|
302
|
+
COPY_STRING_FIELD(name);
|
303
|
+
COPY_SCALAR_FIELD(argnumber);
|
304
|
+
COPY_LOCATION_FIELD(location);
|
305
|
+
|
306
|
+
return newnode;
|
307
|
+
}
|
308
|
+
|
309
|
+
/*
|
310
|
+
* _copyOpExpr
|
311
|
+
*/
|
312
|
+
static OpExpr *
|
313
|
+
_copyOpExpr(const OpExpr *from)
|
314
|
+
{
|
315
|
+
OpExpr *newnode = makeNode(OpExpr);
|
316
|
+
|
317
|
+
COPY_SCALAR_FIELD(opno);
|
318
|
+
COPY_SCALAR_FIELD(opfuncid);
|
319
|
+
COPY_SCALAR_FIELD(opresulttype);
|
320
|
+
COPY_SCALAR_FIELD(opretset);
|
321
|
+
COPY_SCALAR_FIELD(opcollid);
|
322
|
+
COPY_SCALAR_FIELD(inputcollid);
|
323
|
+
COPY_NODE_FIELD(args);
|
324
|
+
COPY_LOCATION_FIELD(location);
|
325
|
+
|
326
|
+
return newnode;
|
327
|
+
}
|
328
|
+
|
329
|
+
/*
|
330
|
+
* _copyDistinctExpr (same as OpExpr)
|
331
|
+
*/
|
332
|
+
static DistinctExpr *
|
333
|
+
_copyDistinctExpr(const DistinctExpr *from)
|
334
|
+
{
|
335
|
+
DistinctExpr *newnode = makeNode(DistinctExpr);
|
336
|
+
|
337
|
+
COPY_SCALAR_FIELD(opno);
|
338
|
+
COPY_SCALAR_FIELD(opfuncid);
|
339
|
+
COPY_SCALAR_FIELD(opresulttype);
|
340
|
+
COPY_SCALAR_FIELD(opretset);
|
341
|
+
COPY_SCALAR_FIELD(opcollid);
|
342
|
+
COPY_SCALAR_FIELD(inputcollid);
|
343
|
+
COPY_NODE_FIELD(args);
|
344
|
+
COPY_LOCATION_FIELD(location);
|
345
|
+
|
346
|
+
return newnode;
|
347
|
+
}
|
348
|
+
|
349
|
+
/*
|
350
|
+
* _copyNullIfExpr (same as OpExpr)
|
351
|
+
*/
|
352
|
+
static NullIfExpr *
|
353
|
+
_copyNullIfExpr(const NullIfExpr *from)
|
354
|
+
{
|
355
|
+
NullIfExpr *newnode = makeNode(NullIfExpr);
|
356
|
+
|
357
|
+
COPY_SCALAR_FIELD(opno);
|
358
|
+
COPY_SCALAR_FIELD(opfuncid);
|
359
|
+
COPY_SCALAR_FIELD(opresulttype);
|
360
|
+
COPY_SCALAR_FIELD(opretset);
|
361
|
+
COPY_SCALAR_FIELD(opcollid);
|
362
|
+
COPY_SCALAR_FIELD(inputcollid);
|
363
|
+
COPY_NODE_FIELD(args);
|
364
|
+
COPY_LOCATION_FIELD(location);
|
365
|
+
|
366
|
+
return newnode;
|
367
|
+
}
|
368
|
+
|
369
|
+
/*
|
370
|
+
* _copyScalarArrayOpExpr
|
371
|
+
*/
|
372
|
+
static ScalarArrayOpExpr *
|
373
|
+
_copyScalarArrayOpExpr(const ScalarArrayOpExpr *from)
|
374
|
+
{
|
375
|
+
ScalarArrayOpExpr *newnode = makeNode(ScalarArrayOpExpr);
|
376
|
+
|
377
|
+
COPY_SCALAR_FIELD(opno);
|
378
|
+
COPY_SCALAR_FIELD(opfuncid);
|
379
|
+
COPY_SCALAR_FIELD(useOr);
|
380
|
+
COPY_SCALAR_FIELD(inputcollid);
|
381
|
+
COPY_NODE_FIELD(args);
|
382
|
+
COPY_LOCATION_FIELD(location);
|
383
|
+
|
384
|
+
return newnode;
|
385
|
+
}
|
386
|
+
|
387
|
+
/*
|
388
|
+
* _copyBoolExpr
|
389
|
+
*/
|
390
|
+
static BoolExpr *
|
391
|
+
_copyBoolExpr(const BoolExpr *from)
|
392
|
+
{
|
393
|
+
BoolExpr *newnode = makeNode(BoolExpr);
|
394
|
+
|
395
|
+
COPY_SCALAR_FIELD(boolop);
|
396
|
+
COPY_NODE_FIELD(args);
|
397
|
+
COPY_LOCATION_FIELD(location);
|
398
|
+
|
399
|
+
return newnode;
|
400
|
+
}
|
401
|
+
|
402
|
+
/*
|
403
|
+
* _copySubLink
|
404
|
+
*/
|
405
|
+
static SubLink *
|
406
|
+
_copySubLink(const SubLink *from)
|
407
|
+
{
|
408
|
+
SubLink *newnode = makeNode(SubLink);
|
409
|
+
|
410
|
+
COPY_SCALAR_FIELD(subLinkType);
|
411
|
+
COPY_NODE_FIELD(testexpr);
|
412
|
+
COPY_NODE_FIELD(operName);
|
413
|
+
COPY_NODE_FIELD(subselect);
|
414
|
+
COPY_LOCATION_FIELD(location);
|
415
|
+
|
416
|
+
return newnode;
|
417
|
+
}
|
418
|
+
|
419
|
+
/*
|
420
|
+
* _copySubPlan
|
421
|
+
*/
|
422
|
+
static SubPlan *
|
423
|
+
_copySubPlan(const SubPlan *from)
|
424
|
+
{
|
425
|
+
SubPlan *newnode = makeNode(SubPlan);
|
426
|
+
|
427
|
+
COPY_SCALAR_FIELD(subLinkType);
|
428
|
+
COPY_NODE_FIELD(testexpr);
|
429
|
+
COPY_NODE_FIELD(paramIds);
|
430
|
+
COPY_SCALAR_FIELD(plan_id);
|
431
|
+
COPY_STRING_FIELD(plan_name);
|
432
|
+
COPY_SCALAR_FIELD(firstColType);
|
433
|
+
COPY_SCALAR_FIELD(firstColTypmod);
|
434
|
+
COPY_SCALAR_FIELD(firstColCollation);
|
435
|
+
COPY_SCALAR_FIELD(useHashTable);
|
436
|
+
COPY_SCALAR_FIELD(unknownEqFalse);
|
437
|
+
COPY_NODE_FIELD(setParam);
|
438
|
+
COPY_NODE_FIELD(parParam);
|
439
|
+
COPY_NODE_FIELD(args);
|
440
|
+
COPY_SCALAR_FIELD(startup_cost);
|
441
|
+
COPY_SCALAR_FIELD(per_call_cost);
|
442
|
+
|
443
|
+
return newnode;
|
444
|
+
}
|
445
|
+
|
446
|
+
/*
|
447
|
+
* _copyAlternativeSubPlan
|
448
|
+
*/
|
449
|
+
static AlternativeSubPlan *
|
450
|
+
_copyAlternativeSubPlan(const AlternativeSubPlan *from)
|
451
|
+
{
|
452
|
+
AlternativeSubPlan *newnode = makeNode(AlternativeSubPlan);
|
453
|
+
|
454
|
+
COPY_NODE_FIELD(subplans);
|
455
|
+
|
456
|
+
return newnode;
|
457
|
+
}
|
458
|
+
|
459
|
+
/*
|
460
|
+
* _copyFieldSelect
|
461
|
+
*/
|
462
|
+
static FieldSelect *
|
463
|
+
_copyFieldSelect(const FieldSelect *from)
|
464
|
+
{
|
465
|
+
FieldSelect *newnode = makeNode(FieldSelect);
|
466
|
+
|
467
|
+
COPY_NODE_FIELD(arg);
|
468
|
+
COPY_SCALAR_FIELD(fieldnum);
|
469
|
+
COPY_SCALAR_FIELD(resulttype);
|
470
|
+
COPY_SCALAR_FIELD(resulttypmod);
|
471
|
+
COPY_SCALAR_FIELD(resultcollid);
|
472
|
+
|
473
|
+
return newnode;
|
474
|
+
}
|
475
|
+
|
476
|
+
/*
|
477
|
+
* _copyFieldStore
|
478
|
+
*/
|
479
|
+
static FieldStore *
|
480
|
+
_copyFieldStore(const FieldStore *from)
|
481
|
+
{
|
482
|
+
FieldStore *newnode = makeNode(FieldStore);
|
483
|
+
|
484
|
+
COPY_NODE_FIELD(arg);
|
485
|
+
COPY_NODE_FIELD(newvals);
|
486
|
+
COPY_NODE_FIELD(fieldnums);
|
487
|
+
COPY_SCALAR_FIELD(resulttype);
|
488
|
+
|
489
|
+
return newnode;
|
490
|
+
}
|
491
|
+
|
492
|
+
/*
|
493
|
+
* _copyRelabelType
|
494
|
+
*/
|
495
|
+
static RelabelType *
|
496
|
+
_copyRelabelType(const RelabelType *from)
|
497
|
+
{
|
498
|
+
RelabelType *newnode = makeNode(RelabelType);
|
499
|
+
|
500
|
+
COPY_NODE_FIELD(arg);
|
501
|
+
COPY_SCALAR_FIELD(resulttype);
|
502
|
+
COPY_SCALAR_FIELD(resulttypmod);
|
503
|
+
COPY_SCALAR_FIELD(resultcollid);
|
504
|
+
COPY_SCALAR_FIELD(relabelformat);
|
505
|
+
COPY_LOCATION_FIELD(location);
|
506
|
+
|
507
|
+
return newnode;
|
508
|
+
}
|
509
|
+
|
510
|
+
/*
|
511
|
+
* _copyCoerceViaIO
|
512
|
+
*/
|
513
|
+
static CoerceViaIO *
|
514
|
+
_copyCoerceViaIO(const CoerceViaIO *from)
|
515
|
+
{
|
516
|
+
CoerceViaIO *newnode = makeNode(CoerceViaIO);
|
517
|
+
|
518
|
+
COPY_NODE_FIELD(arg);
|
519
|
+
COPY_SCALAR_FIELD(resulttype);
|
520
|
+
COPY_SCALAR_FIELD(resultcollid);
|
521
|
+
COPY_SCALAR_FIELD(coerceformat);
|
522
|
+
COPY_LOCATION_FIELD(location);
|
523
|
+
|
524
|
+
return newnode;
|
525
|
+
}
|
526
|
+
|
527
|
+
/*
|
528
|
+
* _copyArrayCoerceExpr
|
529
|
+
*/
|
530
|
+
static ArrayCoerceExpr *
|
531
|
+
_copyArrayCoerceExpr(const ArrayCoerceExpr *from)
|
532
|
+
{
|
533
|
+
ArrayCoerceExpr *newnode = makeNode(ArrayCoerceExpr);
|
534
|
+
|
535
|
+
COPY_NODE_FIELD(arg);
|
536
|
+
COPY_SCALAR_FIELD(elemfuncid);
|
537
|
+
COPY_SCALAR_FIELD(resulttype);
|
538
|
+
COPY_SCALAR_FIELD(resulttypmod);
|
539
|
+
COPY_SCALAR_FIELD(resultcollid);
|
540
|
+
COPY_SCALAR_FIELD(isExplicit);
|
541
|
+
COPY_SCALAR_FIELD(coerceformat);
|
542
|
+
COPY_LOCATION_FIELD(location);
|
543
|
+
|
544
|
+
return newnode;
|
545
|
+
}
|
546
|
+
|
547
|
+
/*
|
548
|
+
* _copyConvertRowtypeExpr
|
549
|
+
*/
|
550
|
+
static ConvertRowtypeExpr *
|
551
|
+
_copyConvertRowtypeExpr(const ConvertRowtypeExpr *from)
|
552
|
+
{
|
553
|
+
ConvertRowtypeExpr *newnode = makeNode(ConvertRowtypeExpr);
|
554
|
+
|
555
|
+
COPY_NODE_FIELD(arg);
|
556
|
+
COPY_SCALAR_FIELD(resulttype);
|
557
|
+
COPY_SCALAR_FIELD(convertformat);
|
558
|
+
COPY_LOCATION_FIELD(location);
|
559
|
+
|
560
|
+
return newnode;
|
561
|
+
}
|
562
|
+
|
563
|
+
/*
|
564
|
+
* _copyCollateExpr
|
565
|
+
*/
|
566
|
+
static CollateExpr *
|
567
|
+
_copyCollateExpr(const CollateExpr *from)
|
568
|
+
{
|
569
|
+
CollateExpr *newnode = makeNode(CollateExpr);
|
570
|
+
|
571
|
+
COPY_NODE_FIELD(arg);
|
572
|
+
COPY_SCALAR_FIELD(collOid);
|
573
|
+
COPY_LOCATION_FIELD(location);
|
574
|
+
|
575
|
+
return newnode;
|
576
|
+
}
|
577
|
+
|
578
|
+
/*
|
579
|
+
* _copyCaseExpr
|
580
|
+
*/
|
581
|
+
static CaseExpr *
|
582
|
+
_copyCaseExpr(const CaseExpr *from)
|
583
|
+
{
|
584
|
+
CaseExpr *newnode = makeNode(CaseExpr);
|
585
|
+
|
586
|
+
COPY_SCALAR_FIELD(casetype);
|
587
|
+
COPY_SCALAR_FIELD(casecollid);
|
588
|
+
COPY_NODE_FIELD(arg);
|
589
|
+
COPY_NODE_FIELD(args);
|
590
|
+
COPY_NODE_FIELD(defresult);
|
591
|
+
COPY_LOCATION_FIELD(location);
|
592
|
+
|
593
|
+
return newnode;
|
594
|
+
}
|
595
|
+
|
596
|
+
/*
|
597
|
+
* _copyCaseWhen
|
598
|
+
*/
|
599
|
+
static CaseWhen *
|
600
|
+
_copyCaseWhen(const CaseWhen *from)
|
601
|
+
{
|
602
|
+
CaseWhen *newnode = makeNode(CaseWhen);
|
603
|
+
|
604
|
+
COPY_NODE_FIELD(expr);
|
605
|
+
COPY_NODE_FIELD(result);
|
606
|
+
COPY_LOCATION_FIELD(location);
|
607
|
+
|
608
|
+
return newnode;
|
609
|
+
}
|
610
|
+
|
611
|
+
/*
|
612
|
+
* _copyCaseTestExpr
|
613
|
+
*/
|
614
|
+
static CaseTestExpr *
|
615
|
+
_copyCaseTestExpr(const CaseTestExpr *from)
|
616
|
+
{
|
617
|
+
CaseTestExpr *newnode = makeNode(CaseTestExpr);
|
618
|
+
|
619
|
+
COPY_SCALAR_FIELD(typeId);
|
620
|
+
COPY_SCALAR_FIELD(typeMod);
|
621
|
+
COPY_SCALAR_FIELD(collation);
|
622
|
+
|
623
|
+
return newnode;
|
624
|
+
}
|
625
|
+
|
626
|
+
/*
|
627
|
+
* _copyArrayExpr
|
628
|
+
*/
|
629
|
+
static ArrayExpr *
|
630
|
+
_copyArrayExpr(const ArrayExpr *from)
|
631
|
+
{
|
632
|
+
ArrayExpr *newnode = makeNode(ArrayExpr);
|
633
|
+
|
634
|
+
COPY_SCALAR_FIELD(array_typeid);
|
635
|
+
COPY_SCALAR_FIELD(array_collid);
|
636
|
+
COPY_SCALAR_FIELD(element_typeid);
|
637
|
+
COPY_NODE_FIELD(elements);
|
638
|
+
COPY_SCALAR_FIELD(multidims);
|
639
|
+
COPY_LOCATION_FIELD(location);
|
640
|
+
|
641
|
+
return newnode;
|
642
|
+
}
|
643
|
+
|
644
|
+
/*
|
645
|
+
* _copyRowExpr
|
646
|
+
*/
|
647
|
+
static RowExpr *
|
648
|
+
_copyRowExpr(const RowExpr *from)
|
649
|
+
{
|
650
|
+
RowExpr *newnode = makeNode(RowExpr);
|
651
|
+
|
652
|
+
COPY_NODE_FIELD(args);
|
653
|
+
COPY_SCALAR_FIELD(row_typeid);
|
654
|
+
COPY_SCALAR_FIELD(row_format);
|
655
|
+
COPY_NODE_FIELD(colnames);
|
656
|
+
COPY_LOCATION_FIELD(location);
|
657
|
+
|
658
|
+
return newnode;
|
659
|
+
}
|
660
|
+
|
661
|
+
/*
|
662
|
+
* _copyRowCompareExpr
|
663
|
+
*/
|
664
|
+
static RowCompareExpr *
|
665
|
+
_copyRowCompareExpr(const RowCompareExpr *from)
|
666
|
+
{
|
667
|
+
RowCompareExpr *newnode = makeNode(RowCompareExpr);
|
668
|
+
|
669
|
+
COPY_SCALAR_FIELD(rctype);
|
670
|
+
COPY_NODE_FIELD(opnos);
|
671
|
+
COPY_NODE_FIELD(opfamilies);
|
672
|
+
COPY_NODE_FIELD(inputcollids);
|
673
|
+
COPY_NODE_FIELD(largs);
|
674
|
+
COPY_NODE_FIELD(rargs);
|
675
|
+
|
676
|
+
return newnode;
|
677
|
+
}
|
678
|
+
|
679
|
+
/*
|
680
|
+
* _copyCoalesceExpr
|
681
|
+
*/
|
682
|
+
static CoalesceExpr *
|
683
|
+
_copyCoalesceExpr(const CoalesceExpr *from)
|
684
|
+
{
|
685
|
+
CoalesceExpr *newnode = makeNode(CoalesceExpr);
|
686
|
+
|
687
|
+
COPY_SCALAR_FIELD(coalescetype);
|
688
|
+
COPY_SCALAR_FIELD(coalescecollid);
|
689
|
+
COPY_NODE_FIELD(args);
|
690
|
+
COPY_LOCATION_FIELD(location);
|
691
|
+
|
692
|
+
return newnode;
|
693
|
+
}
|
694
|
+
|
695
|
+
/*
|
696
|
+
* _copyMinMaxExpr
|
697
|
+
*/
|
698
|
+
static MinMaxExpr *
|
699
|
+
_copyMinMaxExpr(const MinMaxExpr *from)
|
700
|
+
{
|
701
|
+
MinMaxExpr *newnode = makeNode(MinMaxExpr);
|
702
|
+
|
703
|
+
COPY_SCALAR_FIELD(minmaxtype);
|
704
|
+
COPY_SCALAR_FIELD(minmaxcollid);
|
705
|
+
COPY_SCALAR_FIELD(inputcollid);
|
706
|
+
COPY_SCALAR_FIELD(op);
|
707
|
+
COPY_NODE_FIELD(args);
|
708
|
+
COPY_LOCATION_FIELD(location);
|
709
|
+
|
710
|
+
return newnode;
|
711
|
+
}
|
712
|
+
|
713
|
+
/*
|
714
|
+
* _copyXmlExpr
|
715
|
+
*/
|
716
|
+
static XmlExpr *
|
717
|
+
_copyXmlExpr(const XmlExpr *from)
|
718
|
+
{
|
719
|
+
XmlExpr *newnode = makeNode(XmlExpr);
|
720
|
+
|
721
|
+
COPY_SCALAR_FIELD(op);
|
722
|
+
COPY_STRING_FIELD(name);
|
723
|
+
COPY_NODE_FIELD(named_args);
|
724
|
+
COPY_NODE_FIELD(arg_names);
|
725
|
+
COPY_NODE_FIELD(args);
|
726
|
+
COPY_SCALAR_FIELD(xmloption);
|
727
|
+
COPY_SCALAR_FIELD(type);
|
728
|
+
COPY_SCALAR_FIELD(typmod);
|
729
|
+
COPY_LOCATION_FIELD(location);
|
730
|
+
|
731
|
+
return newnode;
|
732
|
+
}
|
733
|
+
|
734
|
+
/*
|
735
|
+
* _copyNullTest
|
736
|
+
*/
|
737
|
+
static NullTest *
|
738
|
+
_copyNullTest(const NullTest *from)
|
739
|
+
{
|
740
|
+
NullTest *newnode = makeNode(NullTest);
|
741
|
+
|
742
|
+
COPY_NODE_FIELD(arg);
|
743
|
+
COPY_SCALAR_FIELD(nulltesttype);
|
744
|
+
COPY_SCALAR_FIELD(argisrow);
|
745
|
+
|
746
|
+
return newnode;
|
747
|
+
}
|
748
|
+
|
749
|
+
/*
|
750
|
+
* _copyBooleanTest
|
751
|
+
*/
|
752
|
+
static BooleanTest *
|
753
|
+
_copyBooleanTest(const BooleanTest *from)
|
754
|
+
{
|
755
|
+
BooleanTest *newnode = makeNode(BooleanTest);
|
756
|
+
|
757
|
+
COPY_NODE_FIELD(arg);
|
758
|
+
COPY_SCALAR_FIELD(booltesttype);
|
759
|
+
|
760
|
+
return newnode;
|
761
|
+
}
|
762
|
+
|
763
|
+
/*
|
764
|
+
* _copyCoerceToDomain
|
765
|
+
*/
|
766
|
+
static CoerceToDomain *
|
767
|
+
_copyCoerceToDomain(const CoerceToDomain *from)
|
768
|
+
{
|
769
|
+
CoerceToDomain *newnode = makeNode(CoerceToDomain);
|
770
|
+
|
771
|
+
COPY_NODE_FIELD(arg);
|
772
|
+
COPY_SCALAR_FIELD(resulttype);
|
773
|
+
COPY_SCALAR_FIELD(resulttypmod);
|
774
|
+
COPY_SCALAR_FIELD(resultcollid);
|
775
|
+
COPY_SCALAR_FIELD(coercionformat);
|
776
|
+
COPY_LOCATION_FIELD(location);
|
777
|
+
|
778
|
+
return newnode;
|
779
|
+
}
|
780
|
+
|
781
|
+
/*
|
782
|
+
* _copyCoerceToDomainValue
|
783
|
+
*/
|
784
|
+
static CoerceToDomainValue *
|
785
|
+
_copyCoerceToDomainValue(const CoerceToDomainValue *from)
|
786
|
+
{
|
787
|
+
CoerceToDomainValue *newnode = makeNode(CoerceToDomainValue);
|
788
|
+
|
789
|
+
COPY_SCALAR_FIELD(typeId);
|
790
|
+
COPY_SCALAR_FIELD(typeMod);
|
791
|
+
COPY_SCALAR_FIELD(collation);
|
792
|
+
COPY_LOCATION_FIELD(location);
|
793
|
+
|
794
|
+
return newnode;
|
795
|
+
}
|
796
|
+
|
797
|
+
/*
|
798
|
+
* _copySetToDefault
|
799
|
+
*/
|
800
|
+
static SetToDefault *
|
801
|
+
_copySetToDefault(const SetToDefault *from)
|
802
|
+
{
|
803
|
+
SetToDefault *newnode = makeNode(SetToDefault);
|
804
|
+
|
805
|
+
COPY_SCALAR_FIELD(typeId);
|
806
|
+
COPY_SCALAR_FIELD(typeMod);
|
807
|
+
COPY_SCALAR_FIELD(collation);
|
808
|
+
COPY_LOCATION_FIELD(location);
|
809
|
+
|
810
|
+
return newnode;
|
811
|
+
}
|
812
|
+
|
813
|
+
/*
|
814
|
+
* _copyCurrentOfExpr
|
815
|
+
*/
|
816
|
+
static CurrentOfExpr *
|
817
|
+
_copyCurrentOfExpr(const CurrentOfExpr *from)
|
818
|
+
{
|
819
|
+
CurrentOfExpr *newnode = makeNode(CurrentOfExpr);
|
820
|
+
|
821
|
+
COPY_SCALAR_FIELD(cvarno);
|
822
|
+
COPY_STRING_FIELD(cursor_name);
|
823
|
+
COPY_SCALAR_FIELD(cursor_param);
|
824
|
+
|
825
|
+
return newnode;
|
826
|
+
}
|
827
|
+
|
828
|
+
/*
|
829
|
+
* _copyTargetEntry
|
830
|
+
*/
|
831
|
+
static TargetEntry *
|
832
|
+
_copyTargetEntry(const TargetEntry *from)
|
833
|
+
{
|
834
|
+
TargetEntry *newnode = makeNode(TargetEntry);
|
835
|
+
|
836
|
+
COPY_NODE_FIELD(expr);
|
837
|
+
COPY_SCALAR_FIELD(resno);
|
838
|
+
COPY_STRING_FIELD(resname);
|
839
|
+
COPY_SCALAR_FIELD(ressortgroupref);
|
840
|
+
COPY_SCALAR_FIELD(resorigtbl);
|
841
|
+
COPY_SCALAR_FIELD(resorigcol);
|
842
|
+
COPY_SCALAR_FIELD(resjunk);
|
843
|
+
|
844
|
+
return newnode;
|
845
|
+
}
|
846
|
+
|
847
|
+
/*
|
848
|
+
* _copyRangeTblRef
|
849
|
+
*/
|
850
|
+
static RangeTblRef *
|
851
|
+
_copyRangeTblRef(const RangeTblRef *from)
|
852
|
+
{
|
853
|
+
RangeTblRef *newnode = makeNode(RangeTblRef);
|
854
|
+
|
855
|
+
COPY_SCALAR_FIELD(rtindex);
|
856
|
+
|
857
|
+
return newnode;
|
858
|
+
}
|
859
|
+
|
860
|
+
/*
|
861
|
+
* _copyJoinExpr
|
862
|
+
*/
|
863
|
+
static JoinExpr *
|
864
|
+
_copyJoinExpr(const JoinExpr *from)
|
865
|
+
{
|
866
|
+
JoinExpr *newnode = makeNode(JoinExpr);
|
867
|
+
|
868
|
+
COPY_SCALAR_FIELD(jointype);
|
869
|
+
COPY_SCALAR_FIELD(isNatural);
|
870
|
+
COPY_NODE_FIELD(larg);
|
871
|
+
COPY_NODE_FIELD(rarg);
|
872
|
+
COPY_NODE_FIELD(usingClause);
|
873
|
+
COPY_NODE_FIELD(quals);
|
874
|
+
COPY_NODE_FIELD(alias);
|
875
|
+
COPY_SCALAR_FIELD(rtindex);
|
876
|
+
|
877
|
+
return newnode;
|
878
|
+
}
|
879
|
+
|
880
|
+
/*
|
881
|
+
* _copyFromExpr
|
882
|
+
*/
|
883
|
+
static FromExpr *
|
884
|
+
_copyFromExpr(const FromExpr *from)
|
885
|
+
{
|
886
|
+
FromExpr *newnode = makeNode(FromExpr);
|
887
|
+
|
888
|
+
COPY_NODE_FIELD(fromlist);
|
889
|
+
COPY_NODE_FIELD(quals);
|
890
|
+
|
891
|
+
return newnode;
|
892
|
+
}
|
893
|
+
|
894
|
+
|
895
|
+
/* ****************************************************************
|
896
|
+
* parsenodes.h copy functions
|
897
|
+
* ****************************************************************
|
898
|
+
*/
|
899
|
+
|
900
|
+
static RangeTblEntry *
|
901
|
+
_copyRangeTblEntry(const RangeTblEntry *from)
|
902
|
+
{
|
903
|
+
RangeTblEntry *newnode = makeNode(RangeTblEntry);
|
904
|
+
|
905
|
+
COPY_SCALAR_FIELD(rtekind);
|
906
|
+
COPY_SCALAR_FIELD(relid);
|
907
|
+
COPY_SCALAR_FIELD(relkind);
|
908
|
+
COPY_NODE_FIELD(subquery);
|
909
|
+
COPY_SCALAR_FIELD(security_barrier);
|
910
|
+
COPY_SCALAR_FIELD(jointype);
|
911
|
+
COPY_NODE_FIELD(joinaliasvars);
|
912
|
+
COPY_NODE_FIELD(funcexpr);
|
913
|
+
COPY_NODE_FIELD(funccoltypes);
|
914
|
+
COPY_NODE_FIELD(funccoltypmods);
|
915
|
+
COPY_NODE_FIELD(funccolcollations);
|
916
|
+
COPY_NODE_FIELD(values_lists);
|
917
|
+
COPY_NODE_FIELD(values_collations);
|
918
|
+
COPY_STRING_FIELD(ctename);
|
919
|
+
COPY_SCALAR_FIELD(ctelevelsup);
|
920
|
+
COPY_SCALAR_FIELD(self_reference);
|
921
|
+
COPY_NODE_FIELD(ctecoltypes);
|
922
|
+
COPY_NODE_FIELD(ctecoltypmods);
|
923
|
+
COPY_NODE_FIELD(ctecolcollations);
|
924
|
+
COPY_NODE_FIELD(alias);
|
925
|
+
COPY_NODE_FIELD(eref);
|
926
|
+
COPY_SCALAR_FIELD(inh);
|
927
|
+
COPY_SCALAR_FIELD(inFromCl);
|
928
|
+
COPY_SCALAR_FIELD(requiredPerms);
|
929
|
+
COPY_SCALAR_FIELD(checkAsUser);
|
930
|
+
COPY_BITMAPSET_FIELD(selectedCols);
|
931
|
+
COPY_BITMAPSET_FIELD(modifiedCols);
|
932
|
+
|
933
|
+
return newnode;
|
934
|
+
}
|
935
|
+
|
936
|
+
static SortGroupClause *
|
937
|
+
_copySortGroupClause(const SortGroupClause *from)
|
938
|
+
{
|
939
|
+
SortGroupClause *newnode = makeNode(SortGroupClause);
|
940
|
+
|
941
|
+
COPY_SCALAR_FIELD(tleSortGroupRef);
|
942
|
+
COPY_SCALAR_FIELD(eqop);
|
943
|
+
COPY_SCALAR_FIELD(sortop);
|
944
|
+
COPY_SCALAR_FIELD(nulls_first);
|
945
|
+
COPY_SCALAR_FIELD(hashable);
|
946
|
+
|
947
|
+
return newnode;
|
948
|
+
}
|
949
|
+
|
950
|
+
static WindowClause *
|
951
|
+
_copyWindowClause(const WindowClause *from)
|
952
|
+
{
|
953
|
+
WindowClause *newnode = makeNode(WindowClause);
|
954
|
+
|
955
|
+
COPY_STRING_FIELD(name);
|
956
|
+
COPY_STRING_FIELD(refname);
|
957
|
+
COPY_NODE_FIELD(partitionClause);
|
958
|
+
COPY_NODE_FIELD(orderClause);
|
959
|
+
COPY_SCALAR_FIELD(frameOptions);
|
960
|
+
COPY_NODE_FIELD(startOffset);
|
961
|
+
COPY_NODE_FIELD(endOffset);
|
962
|
+
COPY_SCALAR_FIELD(winref);
|
963
|
+
COPY_SCALAR_FIELD(copiedOrder);
|
964
|
+
|
965
|
+
return newnode;
|
966
|
+
}
|
967
|
+
|
968
|
+
static RowMarkClause *
|
969
|
+
_copyRowMarkClause(const RowMarkClause *from)
|
970
|
+
{
|
971
|
+
RowMarkClause *newnode = makeNode(RowMarkClause);
|
972
|
+
|
973
|
+
COPY_SCALAR_FIELD(rti);
|
974
|
+
COPY_SCALAR_FIELD(forUpdate);
|
975
|
+
COPY_SCALAR_FIELD(noWait);
|
976
|
+
COPY_SCALAR_FIELD(pushedDown);
|
977
|
+
|
978
|
+
return newnode;
|
979
|
+
}
|
980
|
+
|
981
|
+
static WithClause *
|
982
|
+
_copyWithClause(const WithClause *from)
|
983
|
+
{
|
984
|
+
WithClause *newnode = makeNode(WithClause);
|
985
|
+
|
986
|
+
COPY_NODE_FIELD(ctes);
|
987
|
+
COPY_SCALAR_FIELD(recursive);
|
988
|
+
COPY_LOCATION_FIELD(location);
|
989
|
+
|
990
|
+
return newnode;
|
991
|
+
}
|
992
|
+
|
993
|
+
static CommonTableExpr *
|
994
|
+
_copyCommonTableExpr(const CommonTableExpr *from)
|
995
|
+
{
|
996
|
+
CommonTableExpr *newnode = makeNode(CommonTableExpr);
|
997
|
+
|
998
|
+
COPY_STRING_FIELD(ctename);
|
999
|
+
COPY_NODE_FIELD(aliascolnames);
|
1000
|
+
COPY_NODE_FIELD(ctequery);
|
1001
|
+
COPY_LOCATION_FIELD(location);
|
1002
|
+
COPY_SCALAR_FIELD(cterecursive);
|
1003
|
+
COPY_SCALAR_FIELD(cterefcount);
|
1004
|
+
COPY_NODE_FIELD(ctecolnames);
|
1005
|
+
COPY_NODE_FIELD(ctecoltypes);
|
1006
|
+
COPY_NODE_FIELD(ctecoltypmods);
|
1007
|
+
COPY_NODE_FIELD(ctecolcollations);
|
1008
|
+
|
1009
|
+
return newnode;
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
static A_Expr *
|
1013
|
+
_copyAExpr(const A_Expr *from)
|
1014
|
+
{
|
1015
|
+
A_Expr *newnode = makeNode(A_Expr);
|
1016
|
+
|
1017
|
+
COPY_SCALAR_FIELD(kind);
|
1018
|
+
COPY_NODE_FIELD(name);
|
1019
|
+
COPY_NODE_FIELD(lexpr);
|
1020
|
+
COPY_NODE_FIELD(rexpr);
|
1021
|
+
COPY_LOCATION_FIELD(location);
|
1022
|
+
|
1023
|
+
return newnode;
|
1024
|
+
}
|
1025
|
+
|
1026
|
+
static ColumnRef *
|
1027
|
+
_copyColumnRef(const ColumnRef *from)
|
1028
|
+
{
|
1029
|
+
ColumnRef *newnode = makeNode(ColumnRef);
|
1030
|
+
|
1031
|
+
COPY_NODE_FIELD(fields);
|
1032
|
+
COPY_LOCATION_FIELD(location);
|
1033
|
+
|
1034
|
+
return newnode;
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
static ParamRef *
|
1038
|
+
_copyParamRef(const ParamRef *from)
|
1039
|
+
{
|
1040
|
+
ParamRef *newnode = makeNode(ParamRef);
|
1041
|
+
|
1042
|
+
COPY_SCALAR_FIELD(number);
|
1043
|
+
COPY_LOCATION_FIELD(location);
|
1044
|
+
|
1045
|
+
return newnode;
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
static A_Const *
|
1049
|
+
_copyAConst(const A_Const *from)
|
1050
|
+
{
|
1051
|
+
A_Const *newnode = makeNode(A_Const);
|
1052
|
+
|
1053
|
+
/* This part must duplicate _copyValue */
|
1054
|
+
COPY_SCALAR_FIELD(val.type);
|
1055
|
+
switch (from->val.type)
|
1056
|
+
{
|
1057
|
+
case T_Integer:
|
1058
|
+
COPY_SCALAR_FIELD(val.val.ival);
|
1059
|
+
break;
|
1060
|
+
case T_Float:
|
1061
|
+
case T_String:
|
1062
|
+
case T_BitString:
|
1063
|
+
COPY_STRING_FIELD(val.val.str);
|
1064
|
+
break;
|
1065
|
+
case T_Null:
|
1066
|
+
/* nothing to do */
|
1067
|
+
break;
|
1068
|
+
default:
|
1069
|
+
pool_error("unrecognized node type: %d",
|
1070
|
+
(int) from->val.type);
|
1071
|
+
break;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
COPY_LOCATION_FIELD(location);
|
1075
|
+
|
1076
|
+
return newnode;
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
static FuncCall *
|
1080
|
+
_copyFuncCall(const FuncCall *from)
|
1081
|
+
{
|
1082
|
+
FuncCall *newnode = makeNode(FuncCall);
|
1083
|
+
|
1084
|
+
COPY_NODE_FIELD(funcname);
|
1085
|
+
COPY_NODE_FIELD(args);
|
1086
|
+
COPY_NODE_FIELD(agg_order);
|
1087
|
+
COPY_SCALAR_FIELD(agg_star);
|
1088
|
+
COPY_SCALAR_FIELD(agg_distinct);
|
1089
|
+
COPY_SCALAR_FIELD(func_variadic);
|
1090
|
+
COPY_NODE_FIELD(over);
|
1091
|
+
COPY_LOCATION_FIELD(location);
|
1092
|
+
|
1093
|
+
return newnode;
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
static A_Star *
|
1097
|
+
_copyAStar(const A_Star *from)
|
1098
|
+
{
|
1099
|
+
A_Star *newnode = makeNode(A_Star);
|
1100
|
+
|
1101
|
+
return newnode;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
static A_Indices *
|
1105
|
+
_copyAIndices(const A_Indices *from)
|
1106
|
+
{
|
1107
|
+
A_Indices *newnode = makeNode(A_Indices);
|
1108
|
+
|
1109
|
+
COPY_NODE_FIELD(lidx);
|
1110
|
+
COPY_NODE_FIELD(uidx);
|
1111
|
+
|
1112
|
+
return newnode;
|
1113
|
+
}
|
1114
|
+
|
1115
|
+
static A_Indirection *
|
1116
|
+
_copyA_Indirection(const A_Indirection *from)
|
1117
|
+
{
|
1118
|
+
A_Indirection *newnode = makeNode(A_Indirection);
|
1119
|
+
|
1120
|
+
COPY_NODE_FIELD(arg);
|
1121
|
+
COPY_NODE_FIELD(indirection);
|
1122
|
+
|
1123
|
+
return newnode;
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
static A_ArrayExpr *
|
1127
|
+
_copyA_ArrayExpr(const A_ArrayExpr *from)
|
1128
|
+
{
|
1129
|
+
A_ArrayExpr *newnode = makeNode(A_ArrayExpr);
|
1130
|
+
|
1131
|
+
COPY_NODE_FIELD(elements);
|
1132
|
+
COPY_LOCATION_FIELD(location);
|
1133
|
+
|
1134
|
+
return newnode;
|
1135
|
+
}
|
1136
|
+
|
1137
|
+
static ResTarget *
|
1138
|
+
_copyResTarget(const ResTarget *from)
|
1139
|
+
{
|
1140
|
+
ResTarget *newnode = makeNode(ResTarget);
|
1141
|
+
|
1142
|
+
COPY_STRING_FIELD(name);
|
1143
|
+
COPY_NODE_FIELD(indirection);
|
1144
|
+
COPY_NODE_FIELD(val);
|
1145
|
+
COPY_LOCATION_FIELD(location);
|
1146
|
+
|
1147
|
+
return newnode;
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
static TypeName *
|
1151
|
+
_copyTypeName(const TypeName *from)
|
1152
|
+
{
|
1153
|
+
TypeName *newnode = makeNode(TypeName);
|
1154
|
+
|
1155
|
+
COPY_NODE_FIELD(names);
|
1156
|
+
COPY_SCALAR_FIELD(typeOid);
|
1157
|
+
COPY_SCALAR_FIELD(setof);
|
1158
|
+
COPY_SCALAR_FIELD(pct_type);
|
1159
|
+
COPY_NODE_FIELD(typmods);
|
1160
|
+
COPY_SCALAR_FIELD(typemod);
|
1161
|
+
COPY_NODE_FIELD(arrayBounds);
|
1162
|
+
COPY_LOCATION_FIELD(location);
|
1163
|
+
|
1164
|
+
return newnode;
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
static SortBy *
|
1168
|
+
_copySortBy(const SortBy *from)
|
1169
|
+
{
|
1170
|
+
SortBy *newnode = makeNode(SortBy);
|
1171
|
+
|
1172
|
+
COPY_NODE_FIELD(node);
|
1173
|
+
COPY_SCALAR_FIELD(sortby_dir);
|
1174
|
+
COPY_SCALAR_FIELD(sortby_nulls);
|
1175
|
+
COPY_NODE_FIELD(useOp);
|
1176
|
+
COPY_LOCATION_FIELD(location);
|
1177
|
+
|
1178
|
+
return newnode;
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
static WindowDef *
|
1182
|
+
_copyWindowDef(const WindowDef *from)
|
1183
|
+
{
|
1184
|
+
WindowDef *newnode = makeNode(WindowDef);
|
1185
|
+
|
1186
|
+
COPY_STRING_FIELD(name);
|
1187
|
+
COPY_STRING_FIELD(refname);
|
1188
|
+
COPY_NODE_FIELD(partitionClause);
|
1189
|
+
COPY_NODE_FIELD(orderClause);
|
1190
|
+
COPY_SCALAR_FIELD(frameOptions);
|
1191
|
+
COPY_NODE_FIELD(startOffset);
|
1192
|
+
COPY_NODE_FIELD(endOffset);
|
1193
|
+
COPY_LOCATION_FIELD(location);
|
1194
|
+
|
1195
|
+
return newnode;
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
static RangeSubselect *
|
1199
|
+
_copyRangeSubselect(const RangeSubselect *from)
|
1200
|
+
{
|
1201
|
+
RangeSubselect *newnode = makeNode(RangeSubselect);
|
1202
|
+
|
1203
|
+
COPY_NODE_FIELD(subquery);
|
1204
|
+
COPY_NODE_FIELD(alias);
|
1205
|
+
|
1206
|
+
return newnode;
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
static RangeFunction *
|
1210
|
+
_copyRangeFunction(const RangeFunction *from)
|
1211
|
+
{
|
1212
|
+
RangeFunction *newnode = makeNode(RangeFunction);
|
1213
|
+
|
1214
|
+
COPY_NODE_FIELD(funccallnode);
|
1215
|
+
COPY_NODE_FIELD(alias);
|
1216
|
+
COPY_NODE_FIELD(coldeflist);
|
1217
|
+
|
1218
|
+
return newnode;
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
static TypeCast *
|
1222
|
+
_copyTypeCast(const TypeCast *from)
|
1223
|
+
{
|
1224
|
+
TypeCast *newnode = makeNode(TypeCast);
|
1225
|
+
|
1226
|
+
COPY_NODE_FIELD(arg);
|
1227
|
+
COPY_NODE_FIELD(typeName);
|
1228
|
+
COPY_LOCATION_FIELD(location);
|
1229
|
+
|
1230
|
+
return newnode;
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
static CollateClause *
|
1234
|
+
_copyCollateClause(const CollateClause *from)
|
1235
|
+
{
|
1236
|
+
CollateClause *newnode = makeNode(CollateClause);
|
1237
|
+
|
1238
|
+
COPY_NODE_FIELD(arg);
|
1239
|
+
COPY_NODE_FIELD(collname);
|
1240
|
+
COPY_LOCATION_FIELD(location);
|
1241
|
+
|
1242
|
+
return newnode;
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
static IndexElem *
|
1246
|
+
_copyIndexElem(const IndexElem *from)
|
1247
|
+
{
|
1248
|
+
IndexElem *newnode = makeNode(IndexElem);
|
1249
|
+
|
1250
|
+
COPY_STRING_FIELD(name);
|
1251
|
+
COPY_NODE_FIELD(expr);
|
1252
|
+
COPY_STRING_FIELD(indexcolname);
|
1253
|
+
COPY_NODE_FIELD(collation);
|
1254
|
+
COPY_NODE_FIELD(opclass);
|
1255
|
+
COPY_SCALAR_FIELD(ordering);
|
1256
|
+
COPY_SCALAR_FIELD(nulls_ordering);
|
1257
|
+
|
1258
|
+
return newnode;
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
static ColumnDef *
|
1262
|
+
_copyColumnDef(const ColumnDef *from)
|
1263
|
+
{
|
1264
|
+
ColumnDef *newnode = makeNode(ColumnDef);
|
1265
|
+
|
1266
|
+
COPY_STRING_FIELD(colname);
|
1267
|
+
COPY_NODE_FIELD(typeName);
|
1268
|
+
COPY_SCALAR_FIELD(inhcount);
|
1269
|
+
COPY_SCALAR_FIELD(is_local);
|
1270
|
+
COPY_SCALAR_FIELD(is_not_null);
|
1271
|
+
COPY_SCALAR_FIELD(is_from_type);
|
1272
|
+
COPY_SCALAR_FIELD(storage);
|
1273
|
+
COPY_NODE_FIELD(raw_default);
|
1274
|
+
COPY_NODE_FIELD(cooked_default);
|
1275
|
+
COPY_NODE_FIELD(collClause);
|
1276
|
+
COPY_SCALAR_FIELD(collOid);
|
1277
|
+
COPY_NODE_FIELD(constraints);
|
1278
|
+
COPY_NODE_FIELD(fdwoptions);
|
1279
|
+
|
1280
|
+
return newnode;
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
static Constraint *
|
1284
|
+
_copyConstraint(const Constraint *from)
|
1285
|
+
{
|
1286
|
+
Constraint *newnode = makeNode(Constraint);
|
1287
|
+
|
1288
|
+
COPY_SCALAR_FIELD(contype);
|
1289
|
+
COPY_STRING_FIELD(conname);
|
1290
|
+
COPY_SCALAR_FIELD(deferrable);
|
1291
|
+
COPY_SCALAR_FIELD(initdeferred);
|
1292
|
+
COPY_LOCATION_FIELD(location);
|
1293
|
+
COPY_SCALAR_FIELD(is_no_inherit);
|
1294
|
+
COPY_NODE_FIELD(raw_expr);
|
1295
|
+
COPY_STRING_FIELD(cooked_expr);
|
1296
|
+
COPY_NODE_FIELD(keys);
|
1297
|
+
COPY_NODE_FIELD(exclusions);
|
1298
|
+
COPY_NODE_FIELD(options);
|
1299
|
+
COPY_STRING_FIELD(indexname);
|
1300
|
+
COPY_STRING_FIELD(indexspace);
|
1301
|
+
COPY_STRING_FIELD(access_method);
|
1302
|
+
COPY_NODE_FIELD(where_clause);
|
1303
|
+
COPY_NODE_FIELD(pktable);
|
1304
|
+
COPY_NODE_FIELD(fk_attrs);
|
1305
|
+
COPY_NODE_FIELD(pk_attrs);
|
1306
|
+
COPY_SCALAR_FIELD(fk_matchtype);
|
1307
|
+
COPY_SCALAR_FIELD(fk_upd_action);
|
1308
|
+
COPY_SCALAR_FIELD(fk_del_action);
|
1309
|
+
COPY_NODE_FIELD(old_conpfeqop);
|
1310
|
+
COPY_SCALAR_FIELD(skip_validation);
|
1311
|
+
COPY_SCALAR_FIELD(initially_valid);
|
1312
|
+
|
1313
|
+
return newnode;
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
static DefElem *
|
1317
|
+
_copyDefElem(const DefElem *from)
|
1318
|
+
{
|
1319
|
+
DefElem *newnode = makeNode(DefElem);
|
1320
|
+
|
1321
|
+
COPY_STRING_FIELD(defnamespace);
|
1322
|
+
COPY_STRING_FIELD(defname);
|
1323
|
+
COPY_NODE_FIELD(arg);
|
1324
|
+
COPY_SCALAR_FIELD(defaction);
|
1325
|
+
|
1326
|
+
return newnode;
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
static LockingClause *
|
1330
|
+
_copyLockingClause(const LockingClause *from)
|
1331
|
+
{
|
1332
|
+
LockingClause *newnode = makeNode(LockingClause);
|
1333
|
+
|
1334
|
+
COPY_NODE_FIELD(lockedRels);
|
1335
|
+
COPY_SCALAR_FIELD(forUpdate);
|
1336
|
+
COPY_SCALAR_FIELD(noWait);
|
1337
|
+
|
1338
|
+
return newnode;
|
1339
|
+
}
|
1340
|
+
|
1341
|
+
static XmlSerialize *
|
1342
|
+
_copyXmlSerialize(const XmlSerialize *from)
|
1343
|
+
{
|
1344
|
+
XmlSerialize *newnode = makeNode(XmlSerialize);
|
1345
|
+
|
1346
|
+
COPY_SCALAR_FIELD(xmloption);
|
1347
|
+
COPY_NODE_FIELD(expr);
|
1348
|
+
COPY_NODE_FIELD(typeName);
|
1349
|
+
COPY_LOCATION_FIELD(location);
|
1350
|
+
|
1351
|
+
return newnode;
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
static Query *
|
1355
|
+
_copyQuery(const Query *from)
|
1356
|
+
{
|
1357
|
+
Query *newnode = makeNode(Query);
|
1358
|
+
|
1359
|
+
COPY_SCALAR_FIELD(commandType);
|
1360
|
+
COPY_SCALAR_FIELD(querySource);
|
1361
|
+
COPY_SCALAR_FIELD(queryId);
|
1362
|
+
COPY_SCALAR_FIELD(canSetTag);
|
1363
|
+
COPY_NODE_FIELD(utilityStmt);
|
1364
|
+
COPY_SCALAR_FIELD(resultRelation);
|
1365
|
+
COPY_SCALAR_FIELD(hasAggs);
|
1366
|
+
COPY_SCALAR_FIELD(hasWindowFuncs);
|
1367
|
+
COPY_SCALAR_FIELD(hasSubLinks);
|
1368
|
+
COPY_SCALAR_FIELD(hasDistinctOn);
|
1369
|
+
COPY_SCALAR_FIELD(hasRecursive);
|
1370
|
+
COPY_SCALAR_FIELD(hasModifyingCTE);
|
1371
|
+
COPY_SCALAR_FIELD(hasForUpdate);
|
1372
|
+
COPY_NODE_FIELD(cteList);
|
1373
|
+
COPY_NODE_FIELD(rtable);
|
1374
|
+
COPY_NODE_FIELD(jointree);
|
1375
|
+
COPY_NODE_FIELD(targetList);
|
1376
|
+
COPY_NODE_FIELD(returningList);
|
1377
|
+
COPY_NODE_FIELD(groupClause);
|
1378
|
+
COPY_NODE_FIELD(havingQual);
|
1379
|
+
COPY_NODE_FIELD(windowClause);
|
1380
|
+
COPY_NODE_FIELD(distinctClause);
|
1381
|
+
COPY_NODE_FIELD(sortClause);
|
1382
|
+
COPY_NODE_FIELD(limitOffset);
|
1383
|
+
COPY_NODE_FIELD(limitCount);
|
1384
|
+
COPY_NODE_FIELD(rowMarks);
|
1385
|
+
COPY_NODE_FIELD(setOperations);
|
1386
|
+
COPY_NODE_FIELD(constraintDeps);
|
1387
|
+
|
1388
|
+
return newnode;
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
static InsertStmt *
|
1392
|
+
_copyInsertStmt(const InsertStmt *from)
|
1393
|
+
{
|
1394
|
+
InsertStmt *newnode = makeNode(InsertStmt);
|
1395
|
+
|
1396
|
+
COPY_NODE_FIELD(relation);
|
1397
|
+
COPY_NODE_FIELD(cols);
|
1398
|
+
COPY_NODE_FIELD(selectStmt);
|
1399
|
+
COPY_NODE_FIELD(returningList);
|
1400
|
+
COPY_NODE_FIELD(withClause);
|
1401
|
+
|
1402
|
+
return newnode;
|
1403
|
+
}
|
1404
|
+
|
1405
|
+
static DeleteStmt *
|
1406
|
+
_copyDeleteStmt(const DeleteStmt *from)
|
1407
|
+
{
|
1408
|
+
DeleteStmt *newnode = makeNode(DeleteStmt);
|
1409
|
+
|
1410
|
+
COPY_NODE_FIELD(relation);
|
1411
|
+
COPY_NODE_FIELD(usingClause);
|
1412
|
+
COPY_NODE_FIELD(whereClause);
|
1413
|
+
COPY_NODE_FIELD(returningList);
|
1414
|
+
COPY_NODE_FIELD(withClause);
|
1415
|
+
|
1416
|
+
return newnode;
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
static UpdateStmt *
|
1420
|
+
_copyUpdateStmt(const UpdateStmt *from)
|
1421
|
+
{
|
1422
|
+
UpdateStmt *newnode = makeNode(UpdateStmt);
|
1423
|
+
|
1424
|
+
COPY_NODE_FIELD(relation);
|
1425
|
+
COPY_NODE_FIELD(targetList);
|
1426
|
+
COPY_NODE_FIELD(whereClause);
|
1427
|
+
COPY_NODE_FIELD(fromClause);
|
1428
|
+
COPY_NODE_FIELD(returningList);
|
1429
|
+
COPY_NODE_FIELD(withClause);
|
1430
|
+
|
1431
|
+
return newnode;
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
static SelectStmt *
|
1435
|
+
_copySelectStmt(const SelectStmt *from)
|
1436
|
+
{
|
1437
|
+
SelectStmt *newnode = makeNode(SelectStmt);
|
1438
|
+
|
1439
|
+
COPY_NODE_FIELD(distinctClause);
|
1440
|
+
COPY_NODE_FIELD(intoClause);
|
1441
|
+
COPY_NODE_FIELD(targetList);
|
1442
|
+
COPY_NODE_FIELD(fromClause);
|
1443
|
+
COPY_NODE_FIELD(whereClause);
|
1444
|
+
COPY_NODE_FIELD(groupClause);
|
1445
|
+
COPY_NODE_FIELD(havingClause);
|
1446
|
+
COPY_NODE_FIELD(windowClause);
|
1447
|
+
COPY_NODE_FIELD(withClause);
|
1448
|
+
COPY_NODE_FIELD(valuesLists);
|
1449
|
+
COPY_NODE_FIELD(sortClause);
|
1450
|
+
COPY_NODE_FIELD(limitOffset);
|
1451
|
+
COPY_NODE_FIELD(limitCount);
|
1452
|
+
COPY_NODE_FIELD(lockingClause);
|
1453
|
+
COPY_SCALAR_FIELD(op);
|
1454
|
+
COPY_SCALAR_FIELD(all);
|
1455
|
+
COPY_NODE_FIELD(larg);
|
1456
|
+
COPY_NODE_FIELD(rarg);
|
1457
|
+
|
1458
|
+
return newnode;
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
static SetOperationStmt *
|
1462
|
+
_copySetOperationStmt(const SetOperationStmt *from)
|
1463
|
+
{
|
1464
|
+
SetOperationStmt *newnode = makeNode(SetOperationStmt);
|
1465
|
+
|
1466
|
+
COPY_SCALAR_FIELD(op);
|
1467
|
+
COPY_SCALAR_FIELD(all);
|
1468
|
+
COPY_NODE_FIELD(larg);
|
1469
|
+
COPY_NODE_FIELD(rarg);
|
1470
|
+
COPY_NODE_FIELD(colTypes);
|
1471
|
+
COPY_NODE_FIELD(colTypmods);
|
1472
|
+
COPY_NODE_FIELD(colCollations);
|
1473
|
+
COPY_NODE_FIELD(groupClauses);
|
1474
|
+
|
1475
|
+
return newnode;
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
static AlterTableStmt *
|
1479
|
+
_copyAlterTableStmt(const AlterTableStmt *from)
|
1480
|
+
{
|
1481
|
+
AlterTableStmt *newnode = makeNode(AlterTableStmt);
|
1482
|
+
|
1483
|
+
COPY_NODE_FIELD(relation);
|
1484
|
+
COPY_NODE_FIELD(cmds);
|
1485
|
+
COPY_SCALAR_FIELD(relkind);
|
1486
|
+
COPY_SCALAR_FIELD(missing_ok);
|
1487
|
+
|
1488
|
+
return newnode;
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
static AlterTableCmd *
|
1492
|
+
_copyAlterTableCmd(const AlterTableCmd *from)
|
1493
|
+
{
|
1494
|
+
AlterTableCmd *newnode = makeNode(AlterTableCmd);
|
1495
|
+
|
1496
|
+
COPY_SCALAR_FIELD(subtype);
|
1497
|
+
COPY_STRING_FIELD(name);
|
1498
|
+
COPY_NODE_FIELD(def);
|
1499
|
+
COPY_SCALAR_FIELD(behavior);
|
1500
|
+
COPY_SCALAR_FIELD(missing_ok);
|
1501
|
+
|
1502
|
+
return newnode;
|
1503
|
+
}
|
1504
|
+
|
1505
|
+
static AlterDomainStmt *
|
1506
|
+
_copyAlterDomainStmt(const AlterDomainStmt *from)
|
1507
|
+
{
|
1508
|
+
AlterDomainStmt *newnode = makeNode(AlterDomainStmt);
|
1509
|
+
|
1510
|
+
COPY_SCALAR_FIELD(subtype);
|
1511
|
+
COPY_NODE_FIELD(typeName);
|
1512
|
+
COPY_STRING_FIELD(name);
|
1513
|
+
COPY_NODE_FIELD(def);
|
1514
|
+
COPY_SCALAR_FIELD(behavior);
|
1515
|
+
COPY_SCALAR_FIELD(missing_ok);
|
1516
|
+
|
1517
|
+
return newnode;
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
static GrantStmt *
|
1521
|
+
_copyGrantStmt(const GrantStmt *from)
|
1522
|
+
{
|
1523
|
+
GrantStmt *newnode = makeNode(GrantStmt);
|
1524
|
+
|
1525
|
+
COPY_SCALAR_FIELD(is_grant);
|
1526
|
+
COPY_SCALAR_FIELD(targtype);
|
1527
|
+
COPY_SCALAR_FIELD(objtype);
|
1528
|
+
COPY_NODE_FIELD(objects);
|
1529
|
+
COPY_NODE_FIELD(privileges);
|
1530
|
+
COPY_NODE_FIELD(grantees);
|
1531
|
+
COPY_SCALAR_FIELD(grant_option);
|
1532
|
+
COPY_SCALAR_FIELD(behavior);
|
1533
|
+
|
1534
|
+
return newnode;
|
1535
|
+
}
|
1536
|
+
|
1537
|
+
static PrivGrantee *
|
1538
|
+
_copyPrivGrantee(const PrivGrantee *from)
|
1539
|
+
{
|
1540
|
+
PrivGrantee *newnode = makeNode(PrivGrantee);
|
1541
|
+
|
1542
|
+
COPY_STRING_FIELD(rolname);
|
1543
|
+
|
1544
|
+
return newnode;
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
static FuncWithArgs *
|
1548
|
+
_copyFuncWithArgs(const FuncWithArgs *from)
|
1549
|
+
{
|
1550
|
+
FuncWithArgs *newnode = makeNode(FuncWithArgs);
|
1551
|
+
|
1552
|
+
COPY_NODE_FIELD(funcname);
|
1553
|
+
COPY_NODE_FIELD(funcargs);
|
1554
|
+
|
1555
|
+
return newnode;
|
1556
|
+
}
|
1557
|
+
|
1558
|
+
static AccessPriv *
|
1559
|
+
_copyAccessPriv(const AccessPriv *from)
|
1560
|
+
{
|
1561
|
+
AccessPriv *newnode = makeNode(AccessPriv);
|
1562
|
+
|
1563
|
+
COPY_STRING_FIELD(priv_name);
|
1564
|
+
COPY_NODE_FIELD(cols);
|
1565
|
+
|
1566
|
+
return newnode;
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
static GrantRoleStmt *
|
1570
|
+
_copyGrantRoleStmt(const GrantRoleStmt *from)
|
1571
|
+
{
|
1572
|
+
GrantRoleStmt *newnode = makeNode(GrantRoleStmt);
|
1573
|
+
|
1574
|
+
COPY_NODE_FIELD(granted_roles);
|
1575
|
+
COPY_NODE_FIELD(grantee_roles);
|
1576
|
+
COPY_SCALAR_FIELD(is_grant);
|
1577
|
+
COPY_SCALAR_FIELD(admin_opt);
|
1578
|
+
COPY_STRING_FIELD(grantor);
|
1579
|
+
COPY_SCALAR_FIELD(behavior);
|
1580
|
+
|
1581
|
+
return newnode;
|
1582
|
+
}
|
1583
|
+
|
1584
|
+
static AlterDefaultPrivilegesStmt *
|
1585
|
+
_copyAlterDefaultPrivilegesStmt(const AlterDefaultPrivilegesStmt *from)
|
1586
|
+
{
|
1587
|
+
AlterDefaultPrivilegesStmt *newnode = makeNode(AlterDefaultPrivilegesStmt);
|
1588
|
+
|
1589
|
+
COPY_NODE_FIELD(options);
|
1590
|
+
COPY_NODE_FIELD(action);
|
1591
|
+
|
1592
|
+
return newnode;
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
static DeclareCursorStmt *
|
1596
|
+
_copyDeclareCursorStmt(const DeclareCursorStmt *from)
|
1597
|
+
{
|
1598
|
+
DeclareCursorStmt *newnode = makeNode(DeclareCursorStmt);
|
1599
|
+
|
1600
|
+
COPY_STRING_FIELD(portalname);
|
1601
|
+
COPY_SCALAR_FIELD(options);
|
1602
|
+
COPY_NODE_FIELD(query);
|
1603
|
+
|
1604
|
+
return newnode;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
static ClosePortalStmt *
|
1608
|
+
_copyClosePortalStmt(const ClosePortalStmt *from)
|
1609
|
+
{
|
1610
|
+
ClosePortalStmt *newnode = makeNode(ClosePortalStmt);
|
1611
|
+
|
1612
|
+
COPY_STRING_FIELD(portalname);
|
1613
|
+
|
1614
|
+
return newnode;
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
static ClusterStmt *
|
1618
|
+
_copyClusterStmt(const ClusterStmt *from)
|
1619
|
+
{
|
1620
|
+
ClusterStmt *newnode = makeNode(ClusterStmt);
|
1621
|
+
|
1622
|
+
COPY_NODE_FIELD(relation);
|
1623
|
+
COPY_STRING_FIELD(indexname);
|
1624
|
+
COPY_SCALAR_FIELD(verbose);
|
1625
|
+
|
1626
|
+
return newnode;
|
1627
|
+
}
|
1628
|
+
|
1629
|
+
static CopyStmt *
|
1630
|
+
_copyCopyStmt(const CopyStmt *from)
|
1631
|
+
{
|
1632
|
+
CopyStmt *newnode = makeNode(CopyStmt);
|
1633
|
+
|
1634
|
+
COPY_NODE_FIELD(relation);
|
1635
|
+
COPY_NODE_FIELD(query);
|
1636
|
+
COPY_NODE_FIELD(attlist);
|
1637
|
+
COPY_SCALAR_FIELD(is_from);
|
1638
|
+
COPY_STRING_FIELD(filename);
|
1639
|
+
COPY_NODE_FIELD(options);
|
1640
|
+
|
1641
|
+
return newnode;
|
1642
|
+
}
|
1643
|
+
|
1644
|
+
/*
|
1645
|
+
* CopyCreateStmtFields
|
1646
|
+
*
|
1647
|
+
* This function copies the fields of the CreateStmt node. It is used by
|
1648
|
+
* copy functions for classes which inherit from CreateStmt.
|
1649
|
+
*/
|
1650
|
+
static void
|
1651
|
+
CopyCreateStmtFields(const CreateStmt *from, CreateStmt *newnode)
|
1652
|
+
{
|
1653
|
+
COPY_NODE_FIELD(relation);
|
1654
|
+
COPY_NODE_FIELD(tableElts);
|
1655
|
+
COPY_NODE_FIELD(inhRelations);
|
1656
|
+
COPY_NODE_FIELD(ofTypename);
|
1657
|
+
COPY_NODE_FIELD(constraints);
|
1658
|
+
COPY_NODE_FIELD(options);
|
1659
|
+
COPY_SCALAR_FIELD(oncommit);
|
1660
|
+
COPY_STRING_FIELD(tablespacename);
|
1661
|
+
COPY_SCALAR_FIELD(if_not_exists);
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
static CreateStmt *
|
1665
|
+
_copyCreateStmt(const CreateStmt *from)
|
1666
|
+
{
|
1667
|
+
CreateStmt *newnode = makeNode(CreateStmt);
|
1668
|
+
|
1669
|
+
CopyCreateStmtFields(from, newnode);
|
1670
|
+
|
1671
|
+
return newnode;
|
1672
|
+
}
|
1673
|
+
|
1674
|
+
static TableLikeClause *
|
1675
|
+
_copyTableLikeClause(const TableLikeClause *from)
|
1676
|
+
{
|
1677
|
+
TableLikeClause *newnode = makeNode(TableLikeClause);
|
1678
|
+
|
1679
|
+
COPY_NODE_FIELD(relation);
|
1680
|
+
COPY_SCALAR_FIELD(options);
|
1681
|
+
|
1682
|
+
return newnode;
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
static DefineStmt *
|
1686
|
+
_copyDefineStmt(const DefineStmt *from)
|
1687
|
+
{
|
1688
|
+
DefineStmt *newnode = makeNode(DefineStmt);
|
1689
|
+
|
1690
|
+
COPY_SCALAR_FIELD(kind);
|
1691
|
+
COPY_SCALAR_FIELD(oldstyle);
|
1692
|
+
COPY_NODE_FIELD(defnames);
|
1693
|
+
COPY_NODE_FIELD(args);
|
1694
|
+
COPY_NODE_FIELD(definition);
|
1695
|
+
|
1696
|
+
return newnode;
|
1697
|
+
}
|
1698
|
+
|
1699
|
+
static DropStmt *
|
1700
|
+
_copyDropStmt(const DropStmt *from)
|
1701
|
+
{
|
1702
|
+
DropStmt *newnode = makeNode(DropStmt);
|
1703
|
+
|
1704
|
+
COPY_NODE_FIELD(objects);
|
1705
|
+
COPY_NODE_FIELD(arguments);
|
1706
|
+
COPY_SCALAR_FIELD(removeType);
|
1707
|
+
COPY_SCALAR_FIELD(behavior);
|
1708
|
+
COPY_SCALAR_FIELD(missing_ok);
|
1709
|
+
COPY_SCALAR_FIELD(concurrent);
|
1710
|
+
|
1711
|
+
return newnode;
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
static TruncateStmt *
|
1715
|
+
_copyTruncateStmt(const TruncateStmt *from)
|
1716
|
+
{
|
1717
|
+
TruncateStmt *newnode = makeNode(TruncateStmt);
|
1718
|
+
|
1719
|
+
COPY_NODE_FIELD(relations);
|
1720
|
+
COPY_SCALAR_FIELD(restart_seqs);
|
1721
|
+
COPY_SCALAR_FIELD(behavior);
|
1722
|
+
|
1723
|
+
return newnode;
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
static CommentStmt *
|
1727
|
+
_copyCommentStmt(const CommentStmt *from)
|
1728
|
+
{
|
1729
|
+
CommentStmt *newnode = makeNode(CommentStmt);
|
1730
|
+
|
1731
|
+
COPY_SCALAR_FIELD(objtype);
|
1732
|
+
COPY_NODE_FIELD(objname);
|
1733
|
+
COPY_NODE_FIELD(objargs);
|
1734
|
+
COPY_STRING_FIELD(comment);
|
1735
|
+
|
1736
|
+
return newnode;
|
1737
|
+
}
|
1738
|
+
|
1739
|
+
static SecLabelStmt *
|
1740
|
+
_copySecLabelStmt(const SecLabelStmt *from)
|
1741
|
+
{
|
1742
|
+
SecLabelStmt *newnode = makeNode(SecLabelStmt);
|
1743
|
+
|
1744
|
+
COPY_SCALAR_FIELD(objtype);
|
1745
|
+
COPY_NODE_FIELD(objname);
|
1746
|
+
COPY_NODE_FIELD(objargs);
|
1747
|
+
COPY_STRING_FIELD(provider);
|
1748
|
+
COPY_STRING_FIELD(label);
|
1749
|
+
|
1750
|
+
return newnode;
|
1751
|
+
}
|
1752
|
+
|
1753
|
+
static FetchStmt *
|
1754
|
+
_copyFetchStmt(const FetchStmt *from)
|
1755
|
+
{
|
1756
|
+
FetchStmt *newnode = makeNode(FetchStmt);
|
1757
|
+
|
1758
|
+
COPY_SCALAR_FIELD(direction);
|
1759
|
+
COPY_SCALAR_FIELD(howMany);
|
1760
|
+
COPY_STRING_FIELD(portalname);
|
1761
|
+
COPY_SCALAR_FIELD(ismove);
|
1762
|
+
|
1763
|
+
return newnode;
|
1764
|
+
}
|
1765
|
+
|
1766
|
+
static IndexStmt *
|
1767
|
+
_copyIndexStmt(const IndexStmt *from)
|
1768
|
+
{
|
1769
|
+
IndexStmt *newnode = makeNode(IndexStmt);
|
1770
|
+
|
1771
|
+
COPY_STRING_FIELD(idxname);
|
1772
|
+
COPY_NODE_FIELD(relation);
|
1773
|
+
COPY_STRING_FIELD(accessMethod);
|
1774
|
+
COPY_STRING_FIELD(tableSpace);
|
1775
|
+
COPY_NODE_FIELD(indexParams);
|
1776
|
+
COPY_NODE_FIELD(options);
|
1777
|
+
COPY_NODE_FIELD(whereClause);
|
1778
|
+
COPY_NODE_FIELD(excludeOpNames);
|
1779
|
+
COPY_STRING_FIELD(idxcomment);
|
1780
|
+
COPY_SCALAR_FIELD(indexOid);
|
1781
|
+
COPY_SCALAR_FIELD(oldNode);
|
1782
|
+
COPY_SCALAR_FIELD(unique);
|
1783
|
+
COPY_SCALAR_FIELD(primary);
|
1784
|
+
COPY_SCALAR_FIELD(isconstraint);
|
1785
|
+
COPY_SCALAR_FIELD(deferrable);
|
1786
|
+
COPY_SCALAR_FIELD(initdeferred);
|
1787
|
+
COPY_SCALAR_FIELD(concurrent);
|
1788
|
+
|
1789
|
+
return newnode;
|
1790
|
+
}
|
1791
|
+
|
1792
|
+
static CreateFunctionStmt *
|
1793
|
+
_copyCreateFunctionStmt(const CreateFunctionStmt *from)
|
1794
|
+
{
|
1795
|
+
CreateFunctionStmt *newnode = makeNode(CreateFunctionStmt);
|
1796
|
+
|
1797
|
+
COPY_SCALAR_FIELD(replace);
|
1798
|
+
COPY_NODE_FIELD(funcname);
|
1799
|
+
COPY_NODE_FIELD(parameters);
|
1800
|
+
COPY_NODE_FIELD(returnType);
|
1801
|
+
COPY_NODE_FIELD(options);
|
1802
|
+
COPY_NODE_FIELD(withClause);
|
1803
|
+
|
1804
|
+
return newnode;
|
1805
|
+
}
|
1806
|
+
|
1807
|
+
static FunctionParameter *
|
1808
|
+
_copyFunctionParameter(const FunctionParameter *from)
|
1809
|
+
{
|
1810
|
+
FunctionParameter *newnode = makeNode(FunctionParameter);
|
1811
|
+
|
1812
|
+
COPY_STRING_FIELD(name);
|
1813
|
+
COPY_NODE_FIELD(argType);
|
1814
|
+
COPY_SCALAR_FIELD(mode);
|
1815
|
+
COPY_NODE_FIELD(defexpr);
|
1816
|
+
|
1817
|
+
return newnode;
|
1818
|
+
}
|
1819
|
+
|
1820
|
+
static AlterFunctionStmt *
|
1821
|
+
_copyAlterFunctionStmt(const AlterFunctionStmt *from)
|
1822
|
+
{
|
1823
|
+
AlterFunctionStmt *newnode = makeNode(AlterFunctionStmt);
|
1824
|
+
|
1825
|
+
COPY_NODE_FIELD(func);
|
1826
|
+
COPY_NODE_FIELD(actions);
|
1827
|
+
|
1828
|
+
return newnode;
|
1829
|
+
}
|
1830
|
+
|
1831
|
+
static DoStmt *
|
1832
|
+
_copyDoStmt(const DoStmt *from)
|
1833
|
+
{
|
1834
|
+
DoStmt *newnode = makeNode(DoStmt);
|
1835
|
+
|
1836
|
+
COPY_NODE_FIELD(args);
|
1837
|
+
|
1838
|
+
return newnode;
|
1839
|
+
}
|
1840
|
+
|
1841
|
+
static RenameStmt *
|
1842
|
+
_copyRenameStmt(const RenameStmt *from)
|
1843
|
+
{
|
1844
|
+
RenameStmt *newnode = makeNode(RenameStmt);
|
1845
|
+
|
1846
|
+
COPY_SCALAR_FIELD(renameType);
|
1847
|
+
COPY_SCALAR_FIELD(relationType);
|
1848
|
+
COPY_NODE_FIELD(relation);
|
1849
|
+
COPY_NODE_FIELD(object);
|
1850
|
+
COPY_NODE_FIELD(objarg);
|
1851
|
+
COPY_STRING_FIELD(subname);
|
1852
|
+
COPY_STRING_FIELD(newname);
|
1853
|
+
COPY_SCALAR_FIELD(behavior);
|
1854
|
+
COPY_SCALAR_FIELD(missing_ok);
|
1855
|
+
|
1856
|
+
return newnode;
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
static AlterObjectSchemaStmt *
|
1860
|
+
_copyAlterObjectSchemaStmt(const AlterObjectSchemaStmt *from)
|
1861
|
+
{
|
1862
|
+
AlterObjectSchemaStmt *newnode = makeNode(AlterObjectSchemaStmt);
|
1863
|
+
|
1864
|
+
COPY_SCALAR_FIELD(objectType);
|
1865
|
+
COPY_NODE_FIELD(relation);
|
1866
|
+
COPY_NODE_FIELD(object);
|
1867
|
+
COPY_NODE_FIELD(objarg);
|
1868
|
+
COPY_STRING_FIELD(addname);
|
1869
|
+
COPY_STRING_FIELD(newschema);
|
1870
|
+
COPY_SCALAR_FIELD(missing_ok);
|
1871
|
+
|
1872
|
+
return newnode;
|
1873
|
+
}
|
1874
|
+
|
1875
|
+
static AlterOwnerStmt *
|
1876
|
+
_copyAlterOwnerStmt(const AlterOwnerStmt *from)
|
1877
|
+
{
|
1878
|
+
AlterOwnerStmt *newnode = makeNode(AlterOwnerStmt);
|
1879
|
+
|
1880
|
+
COPY_SCALAR_FIELD(objectType);
|
1881
|
+
COPY_NODE_FIELD(relation);
|
1882
|
+
COPY_NODE_FIELD(object);
|
1883
|
+
COPY_NODE_FIELD(objarg);
|
1884
|
+
COPY_STRING_FIELD(addname);
|
1885
|
+
COPY_STRING_FIELD(newowner);
|
1886
|
+
|
1887
|
+
return newnode;
|
1888
|
+
}
|
1889
|
+
|
1890
|
+
static RuleStmt *
|
1891
|
+
_copyRuleStmt(const RuleStmt *from)
|
1892
|
+
{
|
1893
|
+
RuleStmt *newnode = makeNode(RuleStmt);
|
1894
|
+
|
1895
|
+
COPY_NODE_FIELD(relation);
|
1896
|
+
COPY_STRING_FIELD(rulename);
|
1897
|
+
COPY_NODE_FIELD(whereClause);
|
1898
|
+
COPY_SCALAR_FIELD(event);
|
1899
|
+
COPY_SCALAR_FIELD(instead);
|
1900
|
+
COPY_NODE_FIELD(actions);
|
1901
|
+
COPY_SCALAR_FIELD(replace);
|
1902
|
+
|
1903
|
+
return newnode;
|
1904
|
+
}
|
1905
|
+
|
1906
|
+
static NotifyStmt *
|
1907
|
+
_copyNotifyStmt(const NotifyStmt *from)
|
1908
|
+
{
|
1909
|
+
NotifyStmt *newnode = makeNode(NotifyStmt);
|
1910
|
+
|
1911
|
+
COPY_STRING_FIELD(conditionname);
|
1912
|
+
COPY_STRING_FIELD(payload);
|
1913
|
+
|
1914
|
+
return newnode;
|
1915
|
+
}
|
1916
|
+
|
1917
|
+
static ListenStmt *
|
1918
|
+
_copyListenStmt(const ListenStmt *from)
|
1919
|
+
{
|
1920
|
+
ListenStmt *newnode = makeNode(ListenStmt);
|
1921
|
+
|
1922
|
+
COPY_STRING_FIELD(conditionname);
|
1923
|
+
|
1924
|
+
return newnode;
|
1925
|
+
}
|
1926
|
+
|
1927
|
+
static UnlistenStmt *
|
1928
|
+
_copyUnlistenStmt(const UnlistenStmt *from)
|
1929
|
+
{
|
1930
|
+
UnlistenStmt *newnode = makeNode(UnlistenStmt);
|
1931
|
+
|
1932
|
+
COPY_STRING_FIELD(conditionname);
|
1933
|
+
|
1934
|
+
return newnode;
|
1935
|
+
}
|
1936
|
+
|
1937
|
+
static TransactionStmt *
|
1938
|
+
_copyTransactionStmt(const TransactionStmt *from)
|
1939
|
+
{
|
1940
|
+
TransactionStmt *newnode = makeNode(TransactionStmt);
|
1941
|
+
|
1942
|
+
COPY_SCALAR_FIELD(kind);
|
1943
|
+
COPY_NODE_FIELD(options);
|
1944
|
+
COPY_STRING_FIELD(gid);
|
1945
|
+
|
1946
|
+
return newnode;
|
1947
|
+
}
|
1948
|
+
|
1949
|
+
static CompositeTypeStmt *
|
1950
|
+
_copyCompositeTypeStmt(const CompositeTypeStmt *from)
|
1951
|
+
{
|
1952
|
+
CompositeTypeStmt *newnode = makeNode(CompositeTypeStmt);
|
1953
|
+
|
1954
|
+
COPY_NODE_FIELD(typevar);
|
1955
|
+
COPY_NODE_FIELD(coldeflist);
|
1956
|
+
|
1957
|
+
return newnode;
|
1958
|
+
}
|
1959
|
+
|
1960
|
+
static CreateEnumStmt *
|
1961
|
+
_copyCreateEnumStmt(const CreateEnumStmt *from)
|
1962
|
+
{
|
1963
|
+
CreateEnumStmt *newnode = makeNode(CreateEnumStmt);
|
1964
|
+
|
1965
|
+
COPY_NODE_FIELD(typeName);
|
1966
|
+
COPY_NODE_FIELD(vals);
|
1967
|
+
|
1968
|
+
return newnode;
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
static CreateRangeStmt *
|
1972
|
+
_copyCreateRangeStmt(const CreateRangeStmt *from)
|
1973
|
+
{
|
1974
|
+
CreateRangeStmt *newnode = makeNode(CreateRangeStmt);
|
1975
|
+
|
1976
|
+
COPY_NODE_FIELD(typeName);
|
1977
|
+
COPY_NODE_FIELD(params);
|
1978
|
+
|
1979
|
+
return newnode;
|
1980
|
+
}
|
1981
|
+
|
1982
|
+
static AlterEnumStmt *
|
1983
|
+
_copyAlterEnumStmt(const AlterEnumStmt *from)
|
1984
|
+
{
|
1985
|
+
AlterEnumStmt *newnode = makeNode(AlterEnumStmt);
|
1986
|
+
|
1987
|
+
COPY_NODE_FIELD(typeName);
|
1988
|
+
COPY_STRING_FIELD(newVal);
|
1989
|
+
COPY_STRING_FIELD(newValNeighbor);
|
1990
|
+
COPY_SCALAR_FIELD(newValIsAfter);
|
1991
|
+
|
1992
|
+
return newnode;
|
1993
|
+
}
|
1994
|
+
|
1995
|
+
static ViewStmt *
|
1996
|
+
_copyViewStmt(const ViewStmt *from)
|
1997
|
+
{
|
1998
|
+
ViewStmt *newnode = makeNode(ViewStmt);
|
1999
|
+
|
2000
|
+
COPY_NODE_FIELD(view);
|
2001
|
+
COPY_NODE_FIELD(aliases);
|
2002
|
+
COPY_NODE_FIELD(query);
|
2003
|
+
COPY_SCALAR_FIELD(replace);
|
2004
|
+
COPY_NODE_FIELD(options);
|
2005
|
+
|
2006
|
+
return newnode;
|
2007
|
+
}
|
2008
|
+
|
2009
|
+
static LoadStmt *
|
2010
|
+
_copyLoadStmt(const LoadStmt *from)
|
2011
|
+
{
|
2012
|
+
LoadStmt *newnode = makeNode(LoadStmt);
|
2013
|
+
|
2014
|
+
COPY_STRING_FIELD(filename);
|
2015
|
+
|
2016
|
+
return newnode;
|
2017
|
+
}
|
2018
|
+
|
2019
|
+
static CreateDomainStmt *
|
2020
|
+
_copyCreateDomainStmt(const CreateDomainStmt *from)
|
2021
|
+
{
|
2022
|
+
CreateDomainStmt *newnode = makeNode(CreateDomainStmt);
|
2023
|
+
|
2024
|
+
COPY_NODE_FIELD(domainname);
|
2025
|
+
COPY_NODE_FIELD(typeName);
|
2026
|
+
COPY_NODE_FIELD(collClause);
|
2027
|
+
COPY_NODE_FIELD(constraints);
|
2028
|
+
|
2029
|
+
return newnode;
|
2030
|
+
}
|
2031
|
+
|
2032
|
+
static CreateOpClassStmt *
|
2033
|
+
_copyCreateOpClassStmt(const CreateOpClassStmt *from)
|
2034
|
+
{
|
2035
|
+
CreateOpClassStmt *newnode = makeNode(CreateOpClassStmt);
|
2036
|
+
|
2037
|
+
COPY_NODE_FIELD(opclassname);
|
2038
|
+
COPY_NODE_FIELD(opfamilyname);
|
2039
|
+
COPY_STRING_FIELD(amname);
|
2040
|
+
COPY_NODE_FIELD(datatype);
|
2041
|
+
COPY_NODE_FIELD(items);
|
2042
|
+
COPY_SCALAR_FIELD(isDefault);
|
2043
|
+
|
2044
|
+
return newnode;
|
2045
|
+
}
|
2046
|
+
|
2047
|
+
static CreateOpClassItem *
|
2048
|
+
_copyCreateOpClassItem(const CreateOpClassItem *from)
|
2049
|
+
{
|
2050
|
+
CreateOpClassItem *newnode = makeNode(CreateOpClassItem);
|
2051
|
+
|
2052
|
+
COPY_SCALAR_FIELD(itemtype);
|
2053
|
+
COPY_NODE_FIELD(name);
|
2054
|
+
COPY_NODE_FIELD(args);
|
2055
|
+
COPY_SCALAR_FIELD(number);
|
2056
|
+
COPY_NODE_FIELD(order_family);
|
2057
|
+
COPY_NODE_FIELD(class_args);
|
2058
|
+
COPY_NODE_FIELD(storedtype);
|
2059
|
+
|
2060
|
+
return newnode;
|
2061
|
+
}
|
2062
|
+
|
2063
|
+
static CreateOpFamilyStmt *
|
2064
|
+
_copyCreateOpFamilyStmt(const CreateOpFamilyStmt *from)
|
2065
|
+
{
|
2066
|
+
CreateOpFamilyStmt *newnode = makeNode(CreateOpFamilyStmt);
|
2067
|
+
|
2068
|
+
COPY_NODE_FIELD(opfamilyname);
|
2069
|
+
COPY_STRING_FIELD(amname);
|
2070
|
+
|
2071
|
+
return newnode;
|
2072
|
+
}
|
2073
|
+
|
2074
|
+
static AlterOpFamilyStmt *
|
2075
|
+
_copyAlterOpFamilyStmt(const AlterOpFamilyStmt *from)
|
2076
|
+
{
|
2077
|
+
AlterOpFamilyStmt *newnode = makeNode(AlterOpFamilyStmt);
|
2078
|
+
|
2079
|
+
COPY_NODE_FIELD(opfamilyname);
|
2080
|
+
COPY_STRING_FIELD(amname);
|
2081
|
+
COPY_SCALAR_FIELD(isDrop);
|
2082
|
+
COPY_NODE_FIELD(items);
|
2083
|
+
|
2084
|
+
return newnode;
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
static CreatedbStmt *
|
2088
|
+
_copyCreatedbStmt(const CreatedbStmt *from)
|
2089
|
+
{
|
2090
|
+
CreatedbStmt *newnode = makeNode(CreatedbStmt);
|
2091
|
+
|
2092
|
+
COPY_STRING_FIELD(dbname);
|
2093
|
+
COPY_NODE_FIELD(options);
|
2094
|
+
|
2095
|
+
return newnode;
|
2096
|
+
}
|
2097
|
+
|
2098
|
+
static AlterDatabaseStmt *
|
2099
|
+
_copyAlterDatabaseStmt(const AlterDatabaseStmt *from)
|
2100
|
+
{
|
2101
|
+
AlterDatabaseStmt *newnode = makeNode(AlterDatabaseStmt);
|
2102
|
+
|
2103
|
+
COPY_STRING_FIELD(dbname);
|
2104
|
+
COPY_NODE_FIELD(options);
|
2105
|
+
|
2106
|
+
return newnode;
|
2107
|
+
}
|
2108
|
+
|
2109
|
+
static AlterDatabaseSetStmt *
|
2110
|
+
_copyAlterDatabaseSetStmt(const AlterDatabaseSetStmt *from)
|
2111
|
+
{
|
2112
|
+
AlterDatabaseSetStmt *newnode = makeNode(AlterDatabaseSetStmt);
|
2113
|
+
|
2114
|
+
COPY_STRING_FIELD(dbname);
|
2115
|
+
COPY_NODE_FIELD(setstmt);
|
2116
|
+
|
2117
|
+
return newnode;
|
2118
|
+
}
|
2119
|
+
|
2120
|
+
static DropdbStmt *
|
2121
|
+
_copyDropdbStmt(const DropdbStmt *from)
|
2122
|
+
{
|
2123
|
+
DropdbStmt *newnode = makeNode(DropdbStmt);
|
2124
|
+
|
2125
|
+
COPY_STRING_FIELD(dbname);
|
2126
|
+
COPY_SCALAR_FIELD(missing_ok);
|
2127
|
+
|
2128
|
+
return newnode;
|
2129
|
+
}
|
2130
|
+
|
2131
|
+
static VacuumStmt *
|
2132
|
+
_copyVacuumStmt(const VacuumStmt *from)
|
2133
|
+
{
|
2134
|
+
VacuumStmt *newnode = makeNode(VacuumStmt);
|
2135
|
+
|
2136
|
+
COPY_SCALAR_FIELD(options);
|
2137
|
+
COPY_SCALAR_FIELD(freeze_min_age);
|
2138
|
+
COPY_SCALAR_FIELD(freeze_table_age);
|
2139
|
+
COPY_NODE_FIELD(relation);
|
2140
|
+
COPY_NODE_FIELD(va_cols);
|
2141
|
+
|
2142
|
+
return newnode;
|
2143
|
+
}
|
2144
|
+
|
2145
|
+
static ExplainStmt *
|
2146
|
+
_copyExplainStmt(const ExplainStmt *from)
|
2147
|
+
{
|
2148
|
+
ExplainStmt *newnode = makeNode(ExplainStmt);
|
2149
|
+
|
2150
|
+
COPY_NODE_FIELD(query);
|
2151
|
+
COPY_NODE_FIELD(options);
|
2152
|
+
|
2153
|
+
return newnode;
|
2154
|
+
}
|
2155
|
+
|
2156
|
+
static CreateTableAsStmt *
|
2157
|
+
_copyCreateTableAsStmt(const CreateTableAsStmt *from)
|
2158
|
+
{
|
2159
|
+
CreateTableAsStmt *newnode = makeNode(CreateTableAsStmt);
|
2160
|
+
|
2161
|
+
COPY_NODE_FIELD(query);
|
2162
|
+
COPY_NODE_FIELD(into);
|
2163
|
+
COPY_SCALAR_FIELD(is_select_into);
|
2164
|
+
|
2165
|
+
return newnode;
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
static CreateSeqStmt *
|
2169
|
+
_copyCreateSeqStmt(const CreateSeqStmt *from)
|
2170
|
+
{
|
2171
|
+
CreateSeqStmt *newnode = makeNode(CreateSeqStmt);
|
2172
|
+
|
2173
|
+
COPY_NODE_FIELD(sequence);
|
2174
|
+
COPY_NODE_FIELD(options);
|
2175
|
+
COPY_SCALAR_FIELD(ownerId);
|
2176
|
+
|
2177
|
+
return newnode;
|
2178
|
+
}
|
2179
|
+
|
2180
|
+
static AlterSeqStmt *
|
2181
|
+
_copyAlterSeqStmt(const AlterSeqStmt *from)
|
2182
|
+
{
|
2183
|
+
AlterSeqStmt *newnode = makeNode(AlterSeqStmt);
|
2184
|
+
|
2185
|
+
COPY_NODE_FIELD(sequence);
|
2186
|
+
COPY_NODE_FIELD(options);
|
2187
|
+
COPY_SCALAR_FIELD(missing_ok);
|
2188
|
+
|
2189
|
+
return newnode;
|
2190
|
+
}
|
2191
|
+
|
2192
|
+
static VariableSetStmt *
|
2193
|
+
_copyVariableSetStmt(const VariableSetStmt *from)
|
2194
|
+
{
|
2195
|
+
VariableSetStmt *newnode = makeNode(VariableSetStmt);
|
2196
|
+
|
2197
|
+
COPY_SCALAR_FIELD(kind);
|
2198
|
+
COPY_STRING_FIELD(name);
|
2199
|
+
COPY_NODE_FIELD(args);
|
2200
|
+
COPY_SCALAR_FIELD(is_local);
|
2201
|
+
|
2202
|
+
return newnode;
|
2203
|
+
}
|
2204
|
+
|
2205
|
+
static VariableShowStmt *
|
2206
|
+
_copyVariableShowStmt(const VariableShowStmt *from)
|
2207
|
+
{
|
2208
|
+
VariableShowStmt *newnode = makeNode(VariableShowStmt);
|
2209
|
+
|
2210
|
+
COPY_STRING_FIELD(name);
|
2211
|
+
|
2212
|
+
return newnode;
|
2213
|
+
}
|
2214
|
+
|
2215
|
+
static DiscardStmt *
|
2216
|
+
_copyDiscardStmt(const DiscardStmt *from)
|
2217
|
+
{
|
2218
|
+
DiscardStmt *newnode = makeNode(DiscardStmt);
|
2219
|
+
|
2220
|
+
COPY_SCALAR_FIELD(target);
|
2221
|
+
|
2222
|
+
return newnode;
|
2223
|
+
}
|
2224
|
+
|
2225
|
+
static CreateTableSpaceStmt *
|
2226
|
+
_copyCreateTableSpaceStmt(const CreateTableSpaceStmt *from)
|
2227
|
+
{
|
2228
|
+
CreateTableSpaceStmt *newnode = makeNode(CreateTableSpaceStmt);
|
2229
|
+
|
2230
|
+
COPY_STRING_FIELD(tablespacename);
|
2231
|
+
COPY_STRING_FIELD(owner);
|
2232
|
+
COPY_STRING_FIELD(location);
|
2233
|
+
|
2234
|
+
return newnode;
|
2235
|
+
}
|
2236
|
+
|
2237
|
+
static DropTableSpaceStmt *
|
2238
|
+
_copyDropTableSpaceStmt(const DropTableSpaceStmt *from)
|
2239
|
+
{
|
2240
|
+
DropTableSpaceStmt *newnode = makeNode(DropTableSpaceStmt);
|
2241
|
+
|
2242
|
+
COPY_STRING_FIELD(tablespacename);
|
2243
|
+
COPY_SCALAR_FIELD(missing_ok);
|
2244
|
+
|
2245
|
+
return newnode;
|
2246
|
+
}
|
2247
|
+
|
2248
|
+
static AlterTableSpaceOptionsStmt *
|
2249
|
+
_copyAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *from)
|
2250
|
+
{
|
2251
|
+
AlterTableSpaceOptionsStmt *newnode = makeNode(AlterTableSpaceOptionsStmt);
|
2252
|
+
|
2253
|
+
COPY_STRING_FIELD(tablespacename);
|
2254
|
+
COPY_NODE_FIELD(options);
|
2255
|
+
COPY_SCALAR_FIELD(isReset);
|
2256
|
+
|
2257
|
+
return newnode;
|
2258
|
+
}
|
2259
|
+
|
2260
|
+
static CreateExtensionStmt *
|
2261
|
+
_copyCreateExtensionStmt(const CreateExtensionStmt *from)
|
2262
|
+
{
|
2263
|
+
CreateExtensionStmt *newnode = makeNode(CreateExtensionStmt);
|
2264
|
+
|
2265
|
+
COPY_STRING_FIELD(extname);
|
2266
|
+
COPY_SCALAR_FIELD(if_not_exists);
|
2267
|
+
COPY_NODE_FIELD(options);
|
2268
|
+
|
2269
|
+
return newnode;
|
2270
|
+
}
|
2271
|
+
|
2272
|
+
static AlterExtensionStmt *
|
2273
|
+
_copyAlterExtensionStmt(const AlterExtensionStmt *from)
|
2274
|
+
{
|
2275
|
+
AlterExtensionStmt *newnode = makeNode(AlterExtensionStmt);
|
2276
|
+
|
2277
|
+
COPY_STRING_FIELD(extname);
|
2278
|
+
COPY_NODE_FIELD(options);
|
2279
|
+
|
2280
|
+
return newnode;
|
2281
|
+
}
|
2282
|
+
|
2283
|
+
static AlterExtensionContentsStmt *
|
2284
|
+
_copyAlterExtensionContentsStmt(const AlterExtensionContentsStmt *from)
|
2285
|
+
{
|
2286
|
+
AlterExtensionContentsStmt *newnode = makeNode(AlterExtensionContentsStmt);
|
2287
|
+
|
2288
|
+
COPY_STRING_FIELD(extname);
|
2289
|
+
COPY_SCALAR_FIELD(action);
|
2290
|
+
COPY_SCALAR_FIELD(objtype);
|
2291
|
+
COPY_NODE_FIELD(objname);
|
2292
|
+
COPY_NODE_FIELD(objargs);
|
2293
|
+
|
2294
|
+
return newnode;
|
2295
|
+
}
|
2296
|
+
|
2297
|
+
static CreateFdwStmt *
|
2298
|
+
_copyCreateFdwStmt(const CreateFdwStmt *from)
|
2299
|
+
{
|
2300
|
+
CreateFdwStmt *newnode = makeNode(CreateFdwStmt);
|
2301
|
+
|
2302
|
+
COPY_STRING_FIELD(fdwname);
|
2303
|
+
COPY_NODE_FIELD(func_options);
|
2304
|
+
COPY_NODE_FIELD(options);
|
2305
|
+
|
2306
|
+
return newnode;
|
2307
|
+
}
|
2308
|
+
|
2309
|
+
static AlterFdwStmt *
|
2310
|
+
_copyAlterFdwStmt(const AlterFdwStmt *from)
|
2311
|
+
{
|
2312
|
+
AlterFdwStmt *newnode = makeNode(AlterFdwStmt);
|
2313
|
+
|
2314
|
+
COPY_STRING_FIELD(fdwname);
|
2315
|
+
COPY_NODE_FIELD(func_options);
|
2316
|
+
COPY_NODE_FIELD(options);
|
2317
|
+
|
2318
|
+
return newnode;
|
2319
|
+
}
|
2320
|
+
|
2321
|
+
static CreateForeignServerStmt *
|
2322
|
+
_copyCreateForeignServerStmt(const CreateForeignServerStmt *from)
|
2323
|
+
{
|
2324
|
+
CreateForeignServerStmt *newnode = makeNode(CreateForeignServerStmt);
|
2325
|
+
|
2326
|
+
COPY_STRING_FIELD(servername);
|
2327
|
+
COPY_STRING_FIELD(servertype);
|
2328
|
+
COPY_STRING_FIELD(version);
|
2329
|
+
COPY_STRING_FIELD(fdwname);
|
2330
|
+
COPY_NODE_FIELD(options);
|
2331
|
+
|
2332
|
+
return newnode;
|
2333
|
+
}
|
2334
|
+
|
2335
|
+
static AlterForeignServerStmt *
|
2336
|
+
_copyAlterForeignServerStmt(const AlterForeignServerStmt *from)
|
2337
|
+
{
|
2338
|
+
AlterForeignServerStmt *newnode = makeNode(AlterForeignServerStmt);
|
2339
|
+
|
2340
|
+
COPY_STRING_FIELD(servername);
|
2341
|
+
COPY_STRING_FIELD(version);
|
2342
|
+
COPY_NODE_FIELD(options);
|
2343
|
+
COPY_SCALAR_FIELD(has_version);
|
2344
|
+
|
2345
|
+
return newnode;
|
2346
|
+
}
|
2347
|
+
|
2348
|
+
static CreateUserMappingStmt *
|
2349
|
+
_copyCreateUserMappingStmt(const CreateUserMappingStmt *from)
|
2350
|
+
{
|
2351
|
+
CreateUserMappingStmt *newnode = makeNode(CreateUserMappingStmt);
|
2352
|
+
|
2353
|
+
COPY_STRING_FIELD(username);
|
2354
|
+
COPY_STRING_FIELD(servername);
|
2355
|
+
COPY_NODE_FIELD(options);
|
2356
|
+
|
2357
|
+
return newnode;
|
2358
|
+
}
|
2359
|
+
|
2360
|
+
static AlterUserMappingStmt *
|
2361
|
+
_copyAlterUserMappingStmt(const AlterUserMappingStmt *from)
|
2362
|
+
{
|
2363
|
+
AlterUserMappingStmt *newnode = makeNode(AlterUserMappingStmt);
|
2364
|
+
|
2365
|
+
COPY_STRING_FIELD(username);
|
2366
|
+
COPY_STRING_FIELD(servername);
|
2367
|
+
COPY_NODE_FIELD(options);
|
2368
|
+
|
2369
|
+
return newnode;
|
2370
|
+
}
|
2371
|
+
|
2372
|
+
static DropUserMappingStmt *
|
2373
|
+
_copyDropUserMappingStmt(const DropUserMappingStmt *from)
|
2374
|
+
{
|
2375
|
+
DropUserMappingStmt *newnode = makeNode(DropUserMappingStmt);
|
2376
|
+
|
2377
|
+
COPY_STRING_FIELD(username);
|
2378
|
+
COPY_STRING_FIELD(servername);
|
2379
|
+
COPY_SCALAR_FIELD(missing_ok);
|
2380
|
+
|
2381
|
+
return newnode;
|
2382
|
+
}
|
2383
|
+
|
2384
|
+
static CreateForeignTableStmt *
|
2385
|
+
_copyCreateForeignTableStmt(const CreateForeignTableStmt *from)
|
2386
|
+
{
|
2387
|
+
CreateForeignTableStmt *newnode = makeNode(CreateForeignTableStmt);
|
2388
|
+
|
2389
|
+
CopyCreateStmtFields((const CreateStmt *) from, (CreateStmt *) newnode);
|
2390
|
+
|
2391
|
+
COPY_STRING_FIELD(servername);
|
2392
|
+
COPY_NODE_FIELD(options);
|
2393
|
+
|
2394
|
+
return newnode;
|
2395
|
+
}
|
2396
|
+
|
2397
|
+
static CreateTrigStmt *
|
2398
|
+
_copyCreateTrigStmt(const CreateTrigStmt *from)
|
2399
|
+
{
|
2400
|
+
CreateTrigStmt *newnode = makeNode(CreateTrigStmt);
|
2401
|
+
|
2402
|
+
COPY_STRING_FIELD(trigname);
|
2403
|
+
COPY_NODE_FIELD(relation);
|
2404
|
+
COPY_NODE_FIELD(funcname);
|
2405
|
+
COPY_NODE_FIELD(args);
|
2406
|
+
COPY_SCALAR_FIELD(row);
|
2407
|
+
COPY_SCALAR_FIELD(timing);
|
2408
|
+
COPY_SCALAR_FIELD(events);
|
2409
|
+
COPY_NODE_FIELD(columns);
|
2410
|
+
COPY_NODE_FIELD(whenClause);
|
2411
|
+
COPY_SCALAR_FIELD(isconstraint);
|
2412
|
+
COPY_SCALAR_FIELD(deferrable);
|
2413
|
+
COPY_SCALAR_FIELD(initdeferred);
|
2414
|
+
COPY_NODE_FIELD(constrrel);
|
2415
|
+
|
2416
|
+
return newnode;
|
2417
|
+
}
|
2418
|
+
|
2419
|
+
static CreatePLangStmt *
|
2420
|
+
_copyCreatePLangStmt(const CreatePLangStmt *from)
|
2421
|
+
{
|
2422
|
+
CreatePLangStmt *newnode = makeNode(CreatePLangStmt);
|
2423
|
+
|
2424
|
+
COPY_SCALAR_FIELD(replace);
|
2425
|
+
COPY_STRING_FIELD(plname);
|
2426
|
+
COPY_NODE_FIELD(plhandler);
|
2427
|
+
COPY_NODE_FIELD(plinline);
|
2428
|
+
COPY_NODE_FIELD(plvalidator);
|
2429
|
+
COPY_SCALAR_FIELD(pltrusted);
|
2430
|
+
|
2431
|
+
return newnode;
|
2432
|
+
}
|
2433
|
+
|
2434
|
+
static CreateRoleStmt *
|
2435
|
+
_copyCreateRoleStmt(const CreateRoleStmt *from)
|
2436
|
+
{
|
2437
|
+
CreateRoleStmt *newnode = makeNode(CreateRoleStmt);
|
2438
|
+
|
2439
|
+
COPY_SCALAR_FIELD(stmt_type);
|
2440
|
+
COPY_STRING_FIELD(role);
|
2441
|
+
COPY_NODE_FIELD(options);
|
2442
|
+
|
2443
|
+
return newnode;
|
2444
|
+
}
|
2445
|
+
|
2446
|
+
static AlterRoleStmt *
|
2447
|
+
_copyAlterRoleStmt(const AlterRoleStmt *from)
|
2448
|
+
{
|
2449
|
+
AlterRoleStmt *newnode = makeNode(AlterRoleStmt);
|
2450
|
+
|
2451
|
+
COPY_STRING_FIELD(role);
|
2452
|
+
COPY_NODE_FIELD(options);
|
2453
|
+
COPY_SCALAR_FIELD(action);
|
2454
|
+
|
2455
|
+
return newnode;
|
2456
|
+
}
|
2457
|
+
|
2458
|
+
static AlterRoleSetStmt *
|
2459
|
+
_copyAlterRoleSetStmt(const AlterRoleSetStmt *from)
|
2460
|
+
{
|
2461
|
+
AlterRoleSetStmt *newnode = makeNode(AlterRoleSetStmt);
|
2462
|
+
|
2463
|
+
COPY_STRING_FIELD(role);
|
2464
|
+
COPY_STRING_FIELD(database);
|
2465
|
+
COPY_NODE_FIELD(setstmt);
|
2466
|
+
|
2467
|
+
return newnode;
|
2468
|
+
}
|
2469
|
+
|
2470
|
+
static DropRoleStmt *
|
2471
|
+
_copyDropRoleStmt(const DropRoleStmt *from)
|
2472
|
+
{
|
2473
|
+
DropRoleStmt *newnode = makeNode(DropRoleStmt);
|
2474
|
+
|
2475
|
+
COPY_NODE_FIELD(roles);
|
2476
|
+
COPY_SCALAR_FIELD(missing_ok);
|
2477
|
+
|
2478
|
+
return newnode;
|
2479
|
+
}
|
2480
|
+
|
2481
|
+
static LockStmt *
|
2482
|
+
_copyLockStmt(const LockStmt *from)
|
2483
|
+
{
|
2484
|
+
LockStmt *newnode = makeNode(LockStmt);
|
2485
|
+
|
2486
|
+
COPY_NODE_FIELD(relations);
|
2487
|
+
COPY_SCALAR_FIELD(mode);
|
2488
|
+
COPY_SCALAR_FIELD(nowait);
|
2489
|
+
|
2490
|
+
return newnode;
|
2491
|
+
}
|
2492
|
+
|
2493
|
+
static ConstraintsSetStmt *
|
2494
|
+
_copyConstraintsSetStmt(const ConstraintsSetStmt *from)
|
2495
|
+
{
|
2496
|
+
ConstraintsSetStmt *newnode = makeNode(ConstraintsSetStmt);
|
2497
|
+
|
2498
|
+
COPY_NODE_FIELD(constraints);
|
2499
|
+
COPY_SCALAR_FIELD(deferred);
|
2500
|
+
|
2501
|
+
return newnode;
|
2502
|
+
}
|
2503
|
+
|
2504
|
+
static ReindexStmt *
|
2505
|
+
_copyReindexStmt(const ReindexStmt *from)
|
2506
|
+
{
|
2507
|
+
ReindexStmt *newnode = makeNode(ReindexStmt);
|
2508
|
+
|
2509
|
+
COPY_SCALAR_FIELD(kind);
|
2510
|
+
COPY_NODE_FIELD(relation);
|
2511
|
+
COPY_STRING_FIELD(name);
|
2512
|
+
COPY_SCALAR_FIELD(do_system);
|
2513
|
+
COPY_SCALAR_FIELD(do_user);
|
2514
|
+
|
2515
|
+
return newnode;
|
2516
|
+
}
|
2517
|
+
|
2518
|
+
static CreateSchemaStmt *
|
2519
|
+
_copyCreateSchemaStmt(const CreateSchemaStmt *from)
|
2520
|
+
{
|
2521
|
+
CreateSchemaStmt *newnode = makeNode(CreateSchemaStmt);
|
2522
|
+
|
2523
|
+
COPY_STRING_FIELD(schemaname);
|
2524
|
+
COPY_STRING_FIELD(authid);
|
2525
|
+
COPY_NODE_FIELD(schemaElts);
|
2526
|
+
|
2527
|
+
return newnode;
|
2528
|
+
}
|
2529
|
+
|
2530
|
+
static CreateConversionStmt *
|
2531
|
+
_copyCreateConversionStmt(const CreateConversionStmt *from)
|
2532
|
+
{
|
2533
|
+
CreateConversionStmt *newnode = makeNode(CreateConversionStmt);
|
2534
|
+
|
2535
|
+
COPY_NODE_FIELD(conversion_name);
|
2536
|
+
COPY_STRING_FIELD(for_encoding_name);
|
2537
|
+
COPY_STRING_FIELD(to_encoding_name);
|
2538
|
+
COPY_NODE_FIELD(func_name);
|
2539
|
+
COPY_SCALAR_FIELD(def);
|
2540
|
+
|
2541
|
+
return newnode;
|
2542
|
+
}
|
2543
|
+
|
2544
|
+
static CreateCastStmt *
|
2545
|
+
_copyCreateCastStmt(const CreateCastStmt *from)
|
2546
|
+
{
|
2547
|
+
CreateCastStmt *newnode = makeNode(CreateCastStmt);
|
2548
|
+
|
2549
|
+
COPY_NODE_FIELD(sourcetype);
|
2550
|
+
COPY_NODE_FIELD(targettype);
|
2551
|
+
COPY_NODE_FIELD(func);
|
2552
|
+
COPY_SCALAR_FIELD(context);
|
2553
|
+
COPY_SCALAR_FIELD(inout);
|
2554
|
+
|
2555
|
+
return newnode;
|
2556
|
+
}
|
2557
|
+
|
2558
|
+
static PrepareStmt *
|
2559
|
+
_copyPrepareStmt(const PrepareStmt *from)
|
2560
|
+
{
|
2561
|
+
PrepareStmt *newnode = makeNode(PrepareStmt);
|
2562
|
+
|
2563
|
+
COPY_STRING_FIELD(name);
|
2564
|
+
COPY_NODE_FIELD(argtypes);
|
2565
|
+
COPY_NODE_FIELD(query);
|
2566
|
+
|
2567
|
+
return newnode;
|
2568
|
+
}
|
2569
|
+
|
2570
|
+
static ExecuteStmt *
|
2571
|
+
_copyExecuteStmt(const ExecuteStmt *from)
|
2572
|
+
{
|
2573
|
+
ExecuteStmt *newnode = makeNode(ExecuteStmt);
|
2574
|
+
|
2575
|
+
COPY_STRING_FIELD(name);
|
2576
|
+
COPY_NODE_FIELD(params);
|
2577
|
+
|
2578
|
+
return newnode;
|
2579
|
+
}
|
2580
|
+
|
2581
|
+
static DeallocateStmt *
|
2582
|
+
_copyDeallocateStmt(const DeallocateStmt *from)
|
2583
|
+
{
|
2584
|
+
DeallocateStmt *newnode = makeNode(DeallocateStmt);
|
2585
|
+
|
2586
|
+
COPY_STRING_FIELD(name);
|
2587
|
+
|
2588
|
+
return newnode;
|
2589
|
+
}
|
2590
|
+
|
2591
|
+
static DropOwnedStmt *
|
2592
|
+
_copyDropOwnedStmt(const DropOwnedStmt *from)
|
2593
|
+
{
|
2594
|
+
DropOwnedStmt *newnode = makeNode(DropOwnedStmt);
|
2595
|
+
|
2596
|
+
COPY_NODE_FIELD(roles);
|
2597
|
+
COPY_SCALAR_FIELD(behavior);
|
2598
|
+
|
2599
|
+
return newnode;
|
2600
|
+
}
|
2601
|
+
|
2602
|
+
static ReassignOwnedStmt *
|
2603
|
+
_copyReassignOwnedStmt(const ReassignOwnedStmt *from)
|
2604
|
+
{
|
2605
|
+
ReassignOwnedStmt *newnode = makeNode(ReassignOwnedStmt);
|
2606
|
+
|
2607
|
+
COPY_NODE_FIELD(roles);
|
2608
|
+
COPY_STRING_FIELD(newrole);
|
2609
|
+
|
2610
|
+
return newnode;
|
2611
|
+
}
|
2612
|
+
|
2613
|
+
static AlterTSDictionaryStmt *
|
2614
|
+
_copyAlterTSDictionaryStmt(const AlterTSDictionaryStmt *from)
|
2615
|
+
{
|
2616
|
+
AlterTSDictionaryStmt *newnode = makeNode(AlterTSDictionaryStmt);
|
2617
|
+
|
2618
|
+
COPY_NODE_FIELD(dictname);
|
2619
|
+
COPY_NODE_FIELD(options);
|
2620
|
+
|
2621
|
+
return newnode;
|
2622
|
+
}
|
2623
|
+
|
2624
|
+
static AlterTSConfigurationStmt *
|
2625
|
+
_copyAlterTSConfigurationStmt(const AlterTSConfigurationStmt *from)
|
2626
|
+
{
|
2627
|
+
AlterTSConfigurationStmt *newnode = makeNode(AlterTSConfigurationStmt);
|
2628
|
+
|
2629
|
+
COPY_NODE_FIELD(cfgname);
|
2630
|
+
COPY_NODE_FIELD(tokentype);
|
2631
|
+
COPY_NODE_FIELD(dicts);
|
2632
|
+
COPY_SCALAR_FIELD(override);
|
2633
|
+
COPY_SCALAR_FIELD(replace);
|
2634
|
+
COPY_SCALAR_FIELD(missing_ok);
|
2635
|
+
|
2636
|
+
return newnode;
|
2637
|
+
}
|
2638
|
+
|
2639
|
+
/* ****************************************************************
|
2640
|
+
* pg_list.h copy functions
|
2641
|
+
* ****************************************************************
|
2642
|
+
*/
|
2643
|
+
|
2644
|
+
/*
|
2645
|
+
* Perform a deep copy of the specified list, using copyObject(). The
|
2646
|
+
* list MUST be of type T_List; T_IntList and T_OidList nodes don't
|
2647
|
+
* need deep copies, so they should be copied via list_copy()
|
2648
|
+
*/
|
2649
|
+
#define COPY_NODE_CELL(new, old) \
|
2650
|
+
(new) = (ListCell *) palloc(sizeof(ListCell)); \
|
2651
|
+
lfirst(new) = copyObject(lfirst(old));
|
2652
|
+
|
2653
|
+
static List *
|
2654
|
+
_copyList(const List *from)
|
2655
|
+
{
|
2656
|
+
List *new;
|
2657
|
+
ListCell *curr_old;
|
2658
|
+
ListCell *prev_new;
|
2659
|
+
|
2660
|
+
Assert(list_length(from) >= 1);
|
2661
|
+
|
2662
|
+
new = makeNode(List);
|
2663
|
+
new->length = from->length;
|
2664
|
+
|
2665
|
+
COPY_NODE_CELL(new->head, from->head);
|
2666
|
+
prev_new = new->head;
|
2667
|
+
curr_old = lnext(from->head);
|
2668
|
+
|
2669
|
+
while (curr_old)
|
2670
|
+
{
|
2671
|
+
COPY_NODE_CELL(prev_new->next, curr_old);
|
2672
|
+
prev_new = prev_new->next;
|
2673
|
+
curr_old = curr_old->next;
|
2674
|
+
}
|
2675
|
+
prev_new->next = NULL;
|
2676
|
+
new->tail = prev_new;
|
2677
|
+
|
2678
|
+
return new;
|
2679
|
+
}
|
2680
|
+
|
2681
|
+
/* ****************************************************************
|
2682
|
+
* value.h copy functions
|
2683
|
+
* ****************************************************************
|
2684
|
+
*/
|
2685
|
+
static Value *
|
2686
|
+
_copyValue(const Value *from)
|
2687
|
+
{
|
2688
|
+
Value *newnode = makeNode(Value);
|
2689
|
+
|
2690
|
+
/* See also _copyAConst when changing this code! */
|
2691
|
+
|
2692
|
+
COPY_SCALAR_FIELD(type);
|
2693
|
+
switch (from->type)
|
2694
|
+
{
|
2695
|
+
case T_Integer:
|
2696
|
+
COPY_SCALAR_FIELD(val.ival);
|
2697
|
+
break;
|
2698
|
+
case T_Float:
|
2699
|
+
case T_String:
|
2700
|
+
case T_BitString:
|
2701
|
+
COPY_STRING_FIELD(val.str);
|
2702
|
+
break;
|
2703
|
+
case T_Null:
|
2704
|
+
/* nothing to do */
|
2705
|
+
break;
|
2706
|
+
default:
|
2707
|
+
pool_error("unrecognized node type: %d",
|
2708
|
+
(int) from->type);
|
2709
|
+
break;
|
2710
|
+
}
|
2711
|
+
return newnode;
|
2712
|
+
}
|
2713
|
+
|
2714
|
+
/*
|
2715
|
+
* copyObject
|
2716
|
+
*
|
2717
|
+
* Create a copy of a Node tree or list. This is a "deep" copy: all
|
2718
|
+
* substructure is copied too, recursively.
|
2719
|
+
*/
|
2720
|
+
void *
|
2721
|
+
copyObject(const void *from)
|
2722
|
+
{
|
2723
|
+
void *retval;
|
2724
|
+
|
2725
|
+
if (from == NULL)
|
2726
|
+
return NULL;
|
2727
|
+
|
2728
|
+
#if 0
|
2729
|
+
/* Guard against stack overflow due to overly complex expressions */
|
2730
|
+
check_stack_depth();
|
2731
|
+
#endif
|
2732
|
+
|
2733
|
+
switch (nodeTag(from))
|
2734
|
+
{
|
2735
|
+
/*
|
2736
|
+
* PRIMITIVE NODES
|
2737
|
+
*/
|
2738
|
+
case T_Alias:
|
2739
|
+
retval = _copyAlias(from);
|
2740
|
+
break;
|
2741
|
+
case T_RangeVar:
|
2742
|
+
retval = _copyRangeVar(from);
|
2743
|
+
break;
|
2744
|
+
case T_IntoClause:
|
2745
|
+
retval = _copyIntoClause(from);
|
2746
|
+
break;
|
2747
|
+
case T_Var:
|
2748
|
+
retval = _copyVar(from);
|
2749
|
+
break;
|
2750
|
+
case T_Param:
|
2751
|
+
retval = _copyParam(from);
|
2752
|
+
break;
|
2753
|
+
case T_Aggref:
|
2754
|
+
retval = _copyAggref(from);
|
2755
|
+
break;
|
2756
|
+
case T_WindowFunc:
|
2757
|
+
retval = _copyWindowFunc(from);
|
2758
|
+
break;
|
2759
|
+
case T_ArrayRef:
|
2760
|
+
retval = _copyArrayRef(from);
|
2761
|
+
break;
|
2762
|
+
case T_FuncExpr:
|
2763
|
+
retval = _copyFuncExpr(from);
|
2764
|
+
break;
|
2765
|
+
case T_NamedArgExpr:
|
2766
|
+
retval = _copyNamedArgExpr(from);
|
2767
|
+
break;
|
2768
|
+
case T_OpExpr:
|
2769
|
+
retval = _copyOpExpr(from);
|
2770
|
+
break;
|
2771
|
+
case T_DistinctExpr:
|
2772
|
+
retval = _copyDistinctExpr(from);
|
2773
|
+
break;
|
2774
|
+
case T_NullIfExpr:
|
2775
|
+
retval = _copyNullIfExpr(from);
|
2776
|
+
break;
|
2777
|
+
case T_ScalarArrayOpExpr:
|
2778
|
+
retval = _copyScalarArrayOpExpr(from);
|
2779
|
+
break;
|
2780
|
+
case T_BoolExpr:
|
2781
|
+
retval = _copyBoolExpr(from);
|
2782
|
+
break;
|
2783
|
+
case T_SubLink:
|
2784
|
+
retval = _copySubLink(from);
|
2785
|
+
break;
|
2786
|
+
case T_SubPlan:
|
2787
|
+
retval = _copySubPlan(from);
|
2788
|
+
break;
|
2789
|
+
case T_AlternativeSubPlan:
|
2790
|
+
retval = _copyAlternativeSubPlan(from);
|
2791
|
+
break;
|
2792
|
+
case T_FieldSelect:
|
2793
|
+
retval = _copyFieldSelect(from);
|
2794
|
+
break;
|
2795
|
+
case T_FieldStore:
|
2796
|
+
retval = _copyFieldStore(from);
|
2797
|
+
break;
|
2798
|
+
case T_RelabelType:
|
2799
|
+
retval = _copyRelabelType(from);
|
2800
|
+
break;
|
2801
|
+
case T_CoerceViaIO:
|
2802
|
+
retval = _copyCoerceViaIO(from);
|
2803
|
+
break;
|
2804
|
+
case T_ArrayCoerceExpr:
|
2805
|
+
retval = _copyArrayCoerceExpr(from);
|
2806
|
+
break;
|
2807
|
+
case T_ConvertRowtypeExpr:
|
2808
|
+
retval = _copyConvertRowtypeExpr(from);
|
2809
|
+
break;
|
2810
|
+
case T_CollateExpr:
|
2811
|
+
retval = _copyCollateExpr(from);
|
2812
|
+
break;
|
2813
|
+
case T_CaseExpr:
|
2814
|
+
retval = _copyCaseExpr(from);
|
2815
|
+
break;
|
2816
|
+
case T_CaseWhen:
|
2817
|
+
retval = _copyCaseWhen(from);
|
2818
|
+
break;
|
2819
|
+
case T_CaseTestExpr:
|
2820
|
+
retval = _copyCaseTestExpr(from);
|
2821
|
+
break;
|
2822
|
+
case T_ArrayExpr:
|
2823
|
+
retval = _copyArrayExpr(from);
|
2824
|
+
break;
|
2825
|
+
case T_RowExpr:
|
2826
|
+
retval = _copyRowExpr(from);
|
2827
|
+
break;
|
2828
|
+
case T_RowCompareExpr:
|
2829
|
+
retval = _copyRowCompareExpr(from);
|
2830
|
+
break;
|
2831
|
+
case T_CoalesceExpr:
|
2832
|
+
retval = _copyCoalesceExpr(from);
|
2833
|
+
break;
|
2834
|
+
case T_MinMaxExpr:
|
2835
|
+
retval = _copyMinMaxExpr(from);
|
2836
|
+
break;
|
2837
|
+
case T_XmlExpr:
|
2838
|
+
retval = _copyXmlExpr(from);
|
2839
|
+
break;
|
2840
|
+
case T_NullTest:
|
2841
|
+
retval = _copyNullTest(from);
|
2842
|
+
break;
|
2843
|
+
case T_BooleanTest:
|
2844
|
+
retval = _copyBooleanTest(from);
|
2845
|
+
break;
|
2846
|
+
case T_CoerceToDomain:
|
2847
|
+
retval = _copyCoerceToDomain(from);
|
2848
|
+
break;
|
2849
|
+
case T_CoerceToDomainValue:
|
2850
|
+
retval = _copyCoerceToDomainValue(from);
|
2851
|
+
break;
|
2852
|
+
case T_SetToDefault:
|
2853
|
+
retval = _copySetToDefault(from);
|
2854
|
+
break;
|
2855
|
+
case T_CurrentOfExpr:
|
2856
|
+
retval = _copyCurrentOfExpr(from);
|
2857
|
+
break;
|
2858
|
+
case T_TargetEntry:
|
2859
|
+
retval = _copyTargetEntry(from);
|
2860
|
+
break;
|
2861
|
+
case T_RangeTblRef:
|
2862
|
+
retval = _copyRangeTblRef(from);
|
2863
|
+
break;
|
2864
|
+
case T_JoinExpr:
|
2865
|
+
retval = _copyJoinExpr(from);
|
2866
|
+
break;
|
2867
|
+
case T_FromExpr:
|
2868
|
+
retval = _copyFromExpr(from);
|
2869
|
+
break;
|
2870
|
+
|
2871
|
+
/*
|
2872
|
+
* VALUE NODES
|
2873
|
+
*/
|
2874
|
+
case T_Integer:
|
2875
|
+
case T_Float:
|
2876
|
+
case T_String:
|
2877
|
+
case T_BitString:
|
2878
|
+
case T_Null:
|
2879
|
+
retval = _copyValue(from);
|
2880
|
+
break;
|
2881
|
+
|
2882
|
+
/*
|
2883
|
+
* LIST NODES
|
2884
|
+
*/
|
2885
|
+
case T_List:
|
2886
|
+
retval = _copyList(from);
|
2887
|
+
break;
|
2888
|
+
|
2889
|
+
/*
|
2890
|
+
* Lists of integers and OIDs don't need to be deep-copied, so we
|
2891
|
+
* perform a shallow copy via list_copy()
|
2892
|
+
*/
|
2893
|
+
case T_IntList:
|
2894
|
+
case T_OidList:
|
2895
|
+
retval = list_copy(from);
|
2896
|
+
break;
|
2897
|
+
|
2898
|
+
/*
|
2899
|
+
* PARSE NODES
|
2900
|
+
*/
|
2901
|
+
case T_Query:
|
2902
|
+
retval = _copyQuery(from);
|
2903
|
+
break;
|
2904
|
+
case T_InsertStmt:
|
2905
|
+
retval = _copyInsertStmt(from);
|
2906
|
+
break;
|
2907
|
+
case T_DeleteStmt:
|
2908
|
+
retval = _copyDeleteStmt(from);
|
2909
|
+
break;
|
2910
|
+
case T_UpdateStmt:
|
2911
|
+
retval = _copyUpdateStmt(from);
|
2912
|
+
break;
|
2913
|
+
case T_SelectStmt:
|
2914
|
+
retval = _copySelectStmt(from);
|
2915
|
+
break;
|
2916
|
+
case T_SetOperationStmt:
|
2917
|
+
retval = _copySetOperationStmt(from);
|
2918
|
+
break;
|
2919
|
+
case T_AlterTableStmt:
|
2920
|
+
retval = _copyAlterTableStmt(from);
|
2921
|
+
break;
|
2922
|
+
case T_AlterTableCmd:
|
2923
|
+
retval = _copyAlterTableCmd(from);
|
2924
|
+
break;
|
2925
|
+
case T_AlterDomainStmt:
|
2926
|
+
retval = _copyAlterDomainStmt(from);
|
2927
|
+
break;
|
2928
|
+
case T_GrantStmt:
|
2929
|
+
retval = _copyGrantStmt(from);
|
2930
|
+
break;
|
2931
|
+
case T_GrantRoleStmt:
|
2932
|
+
retval = _copyGrantRoleStmt(from);
|
2933
|
+
break;
|
2934
|
+
case T_AlterDefaultPrivilegesStmt:
|
2935
|
+
retval = _copyAlterDefaultPrivilegesStmt(from);
|
2936
|
+
break;
|
2937
|
+
case T_DeclareCursorStmt:
|
2938
|
+
retval = _copyDeclareCursorStmt(from);
|
2939
|
+
break;
|
2940
|
+
case T_ClosePortalStmt:
|
2941
|
+
retval = _copyClosePortalStmt(from);
|
2942
|
+
break;
|
2943
|
+
case T_ClusterStmt:
|
2944
|
+
retval = _copyClusterStmt(from);
|
2945
|
+
break;
|
2946
|
+
case T_CopyStmt:
|
2947
|
+
retval = _copyCopyStmt(from);
|
2948
|
+
break;
|
2949
|
+
case T_CreateStmt:
|
2950
|
+
retval = _copyCreateStmt(from);
|
2951
|
+
break;
|
2952
|
+
case T_TableLikeClause:
|
2953
|
+
retval = _copyTableLikeClause(from);
|
2954
|
+
break;
|
2955
|
+
case T_DefineStmt:
|
2956
|
+
retval = _copyDefineStmt(from);
|
2957
|
+
break;
|
2958
|
+
case T_DropStmt:
|
2959
|
+
retval = _copyDropStmt(from);
|
2960
|
+
break;
|
2961
|
+
case T_TruncateStmt:
|
2962
|
+
retval = _copyTruncateStmt(from);
|
2963
|
+
break;
|
2964
|
+
case T_CommentStmt:
|
2965
|
+
retval = _copyCommentStmt(from);
|
2966
|
+
break;
|
2967
|
+
case T_SecLabelStmt:
|
2968
|
+
retval = _copySecLabelStmt(from);
|
2969
|
+
break;
|
2970
|
+
case T_FetchStmt:
|
2971
|
+
retval = _copyFetchStmt(from);
|
2972
|
+
break;
|
2973
|
+
case T_IndexStmt:
|
2974
|
+
retval = _copyIndexStmt(from);
|
2975
|
+
break;
|
2976
|
+
case T_CreateFunctionStmt:
|
2977
|
+
retval = _copyCreateFunctionStmt(from);
|
2978
|
+
break;
|
2979
|
+
case T_FunctionParameter:
|
2980
|
+
retval = _copyFunctionParameter(from);
|
2981
|
+
break;
|
2982
|
+
case T_AlterFunctionStmt:
|
2983
|
+
retval = _copyAlterFunctionStmt(from);
|
2984
|
+
break;
|
2985
|
+
case T_DoStmt:
|
2986
|
+
retval = _copyDoStmt(from);
|
2987
|
+
break;
|
2988
|
+
case T_RenameStmt:
|
2989
|
+
retval = _copyRenameStmt(from);
|
2990
|
+
break;
|
2991
|
+
case T_AlterObjectSchemaStmt:
|
2992
|
+
retval = _copyAlterObjectSchemaStmt(from);
|
2993
|
+
break;
|
2994
|
+
case T_AlterOwnerStmt:
|
2995
|
+
retval = _copyAlterOwnerStmt(from);
|
2996
|
+
break;
|
2997
|
+
case T_RuleStmt:
|
2998
|
+
retval = _copyRuleStmt(from);
|
2999
|
+
break;
|
3000
|
+
case T_NotifyStmt:
|
3001
|
+
retval = _copyNotifyStmt(from);
|
3002
|
+
break;
|
3003
|
+
case T_ListenStmt:
|
3004
|
+
retval = _copyListenStmt(from);
|
3005
|
+
break;
|
3006
|
+
case T_UnlistenStmt:
|
3007
|
+
retval = _copyUnlistenStmt(from);
|
3008
|
+
break;
|
3009
|
+
case T_TransactionStmt:
|
3010
|
+
retval = _copyTransactionStmt(from);
|
3011
|
+
break;
|
3012
|
+
case T_CompositeTypeStmt:
|
3013
|
+
retval = _copyCompositeTypeStmt(from);
|
3014
|
+
break;
|
3015
|
+
case T_CreateEnumStmt:
|
3016
|
+
retval = _copyCreateEnumStmt(from);
|
3017
|
+
break;
|
3018
|
+
case T_CreateRangeStmt:
|
3019
|
+
retval = _copyCreateRangeStmt(from);
|
3020
|
+
break;
|
3021
|
+
case T_AlterEnumStmt:
|
3022
|
+
retval = _copyAlterEnumStmt(from);
|
3023
|
+
break;
|
3024
|
+
case T_ViewStmt:
|
3025
|
+
retval = _copyViewStmt(from);
|
3026
|
+
break;
|
3027
|
+
case T_LoadStmt:
|
3028
|
+
retval = _copyLoadStmt(from);
|
3029
|
+
break;
|
3030
|
+
case T_CreateDomainStmt:
|
3031
|
+
retval = _copyCreateDomainStmt(from);
|
3032
|
+
break;
|
3033
|
+
case T_CreateOpClassStmt:
|
3034
|
+
retval = _copyCreateOpClassStmt(from);
|
3035
|
+
break;
|
3036
|
+
case T_CreateOpClassItem:
|
3037
|
+
retval = _copyCreateOpClassItem(from);
|
3038
|
+
break;
|
3039
|
+
case T_CreateOpFamilyStmt:
|
3040
|
+
retval = _copyCreateOpFamilyStmt(from);
|
3041
|
+
break;
|
3042
|
+
case T_AlterOpFamilyStmt:
|
3043
|
+
retval = _copyAlterOpFamilyStmt(from);
|
3044
|
+
break;
|
3045
|
+
case T_CreatedbStmt:
|
3046
|
+
retval = _copyCreatedbStmt(from);
|
3047
|
+
break;
|
3048
|
+
case T_AlterDatabaseStmt:
|
3049
|
+
retval = _copyAlterDatabaseStmt(from);
|
3050
|
+
break;
|
3051
|
+
case T_AlterDatabaseSetStmt:
|
3052
|
+
retval = _copyAlterDatabaseSetStmt(from);
|
3053
|
+
break;
|
3054
|
+
case T_DropdbStmt:
|
3055
|
+
retval = _copyDropdbStmt(from);
|
3056
|
+
break;
|
3057
|
+
case T_VacuumStmt:
|
3058
|
+
retval = _copyVacuumStmt(from);
|
3059
|
+
break;
|
3060
|
+
case T_ExplainStmt:
|
3061
|
+
retval = _copyExplainStmt(from);
|
3062
|
+
break;
|
3063
|
+
case T_CreateTableAsStmt:
|
3064
|
+
retval = _copyCreateTableAsStmt(from);
|
3065
|
+
break;
|
3066
|
+
case T_CreateSeqStmt:
|
3067
|
+
retval = _copyCreateSeqStmt(from);
|
3068
|
+
break;
|
3069
|
+
case T_AlterSeqStmt:
|
3070
|
+
retval = _copyAlterSeqStmt(from);
|
3071
|
+
break;
|
3072
|
+
case T_VariableSetStmt:
|
3073
|
+
retval = _copyVariableSetStmt(from);
|
3074
|
+
break;
|
3075
|
+
case T_VariableShowStmt:
|
3076
|
+
retval = _copyVariableShowStmt(from);
|
3077
|
+
break;
|
3078
|
+
case T_DiscardStmt:
|
3079
|
+
retval = _copyDiscardStmt(from);
|
3080
|
+
break;
|
3081
|
+
case T_CreateTableSpaceStmt:
|
3082
|
+
retval = _copyCreateTableSpaceStmt(from);
|
3083
|
+
break;
|
3084
|
+
case T_DropTableSpaceStmt:
|
3085
|
+
retval = _copyDropTableSpaceStmt(from);
|
3086
|
+
break;
|
3087
|
+
case T_AlterTableSpaceOptionsStmt:
|
3088
|
+
retval = _copyAlterTableSpaceOptionsStmt(from);
|
3089
|
+
break;
|
3090
|
+
case T_CreateExtensionStmt:
|
3091
|
+
retval = _copyCreateExtensionStmt(from);
|
3092
|
+
break;
|
3093
|
+
case T_AlterExtensionStmt:
|
3094
|
+
retval = _copyAlterExtensionStmt(from);
|
3095
|
+
break;
|
3096
|
+
case T_AlterExtensionContentsStmt:
|
3097
|
+
retval = _copyAlterExtensionContentsStmt(from);
|
3098
|
+
break;
|
3099
|
+
case T_CreateFdwStmt:
|
3100
|
+
retval = _copyCreateFdwStmt(from);
|
3101
|
+
break;
|
3102
|
+
case T_AlterFdwStmt:
|
3103
|
+
retval = _copyAlterFdwStmt(from);
|
3104
|
+
break;
|
3105
|
+
case T_CreateForeignServerStmt:
|
3106
|
+
retval = _copyCreateForeignServerStmt(from);
|
3107
|
+
break;
|
3108
|
+
case T_AlterForeignServerStmt:
|
3109
|
+
retval = _copyAlterForeignServerStmt(from);
|
3110
|
+
break;
|
3111
|
+
case T_CreateUserMappingStmt:
|
3112
|
+
retval = _copyCreateUserMappingStmt(from);
|
3113
|
+
break;
|
3114
|
+
case T_AlterUserMappingStmt:
|
3115
|
+
retval = _copyAlterUserMappingStmt(from);
|
3116
|
+
break;
|
3117
|
+
case T_DropUserMappingStmt:
|
3118
|
+
retval = _copyDropUserMappingStmt(from);
|
3119
|
+
break;
|
3120
|
+
case T_CreateForeignTableStmt:
|
3121
|
+
retval = _copyCreateForeignTableStmt(from);
|
3122
|
+
break;
|
3123
|
+
case T_CreateTrigStmt:
|
3124
|
+
retval = _copyCreateTrigStmt(from);
|
3125
|
+
break;
|
3126
|
+
case T_CreatePLangStmt:
|
3127
|
+
retval = _copyCreatePLangStmt(from);
|
3128
|
+
break;
|
3129
|
+
case T_CreateRoleStmt:
|
3130
|
+
retval = _copyCreateRoleStmt(from);
|
3131
|
+
break;
|
3132
|
+
case T_AlterRoleStmt:
|
3133
|
+
retval = _copyAlterRoleStmt(from);
|
3134
|
+
break;
|
3135
|
+
case T_AlterRoleSetStmt:
|
3136
|
+
retval = _copyAlterRoleSetStmt(from);
|
3137
|
+
break;
|
3138
|
+
case T_DropRoleStmt:
|
3139
|
+
retval = _copyDropRoleStmt(from);
|
3140
|
+
break;
|
3141
|
+
case T_LockStmt:
|
3142
|
+
retval = _copyLockStmt(from);
|
3143
|
+
break;
|
3144
|
+
case T_ConstraintsSetStmt:
|
3145
|
+
retval = _copyConstraintsSetStmt(from);
|
3146
|
+
break;
|
3147
|
+
case T_ReindexStmt:
|
3148
|
+
retval = _copyReindexStmt(from);
|
3149
|
+
break;
|
3150
|
+
case T_CheckPointStmt:
|
3151
|
+
retval = (void *) makeNode(CheckPointStmt);
|
3152
|
+
break;
|
3153
|
+
case T_CreateSchemaStmt:
|
3154
|
+
retval = _copyCreateSchemaStmt(from);
|
3155
|
+
break;
|
3156
|
+
case T_CreateConversionStmt:
|
3157
|
+
retval = _copyCreateConversionStmt(from);
|
3158
|
+
break;
|
3159
|
+
case T_CreateCastStmt:
|
3160
|
+
retval = _copyCreateCastStmt(from);
|
3161
|
+
break;
|
3162
|
+
case T_PrepareStmt:
|
3163
|
+
retval = _copyPrepareStmt(from);
|
3164
|
+
break;
|
3165
|
+
case T_ExecuteStmt:
|
3166
|
+
retval = _copyExecuteStmt(from);
|
3167
|
+
break;
|
3168
|
+
case T_DeallocateStmt:
|
3169
|
+
retval = _copyDeallocateStmt(from);
|
3170
|
+
break;
|
3171
|
+
case T_DropOwnedStmt:
|
3172
|
+
retval = _copyDropOwnedStmt(from);
|
3173
|
+
break;
|
3174
|
+
case T_ReassignOwnedStmt:
|
3175
|
+
retval = _copyReassignOwnedStmt(from);
|
3176
|
+
break;
|
3177
|
+
case T_AlterTSDictionaryStmt:
|
3178
|
+
retval = _copyAlterTSDictionaryStmt(from);
|
3179
|
+
break;
|
3180
|
+
case T_AlterTSConfigurationStmt:
|
3181
|
+
retval = _copyAlterTSConfigurationStmt(from);
|
3182
|
+
break;
|
3183
|
+
|
3184
|
+
case T_A_Expr:
|
3185
|
+
retval = _copyAExpr(from);
|
3186
|
+
break;
|
3187
|
+
case T_ColumnRef:
|
3188
|
+
retval = _copyColumnRef(from);
|
3189
|
+
break;
|
3190
|
+
case T_ParamRef:
|
3191
|
+
retval = _copyParamRef(from);
|
3192
|
+
break;
|
3193
|
+
case T_A_Const:
|
3194
|
+
retval = _copyAConst(from);
|
3195
|
+
break;
|
3196
|
+
case T_FuncCall:
|
3197
|
+
retval = _copyFuncCall(from);
|
3198
|
+
break;
|
3199
|
+
case T_A_Star:
|
3200
|
+
retval = _copyAStar(from);
|
3201
|
+
break;
|
3202
|
+
case T_A_Indices:
|
3203
|
+
retval = _copyAIndices(from);
|
3204
|
+
break;
|
3205
|
+
case T_A_Indirection:
|
3206
|
+
retval = _copyA_Indirection(from);
|
3207
|
+
break;
|
3208
|
+
case T_A_ArrayExpr:
|
3209
|
+
retval = _copyA_ArrayExpr(from);
|
3210
|
+
break;
|
3211
|
+
case T_ResTarget:
|
3212
|
+
retval = _copyResTarget(from);
|
3213
|
+
break;
|
3214
|
+
case T_TypeCast:
|
3215
|
+
retval = _copyTypeCast(from);
|
3216
|
+
break;
|
3217
|
+
case T_CollateClause:
|
3218
|
+
retval = _copyCollateClause(from);
|
3219
|
+
break;
|
3220
|
+
case T_SortBy:
|
3221
|
+
retval = _copySortBy(from);
|
3222
|
+
break;
|
3223
|
+
case T_WindowDef:
|
3224
|
+
retval = _copyWindowDef(from);
|
3225
|
+
break;
|
3226
|
+
case T_RangeSubselect:
|
3227
|
+
retval = _copyRangeSubselect(from);
|
3228
|
+
break;
|
3229
|
+
case T_RangeFunction:
|
3230
|
+
retval = _copyRangeFunction(from);
|
3231
|
+
break;
|
3232
|
+
case T_TypeName:
|
3233
|
+
retval = _copyTypeName(from);
|
3234
|
+
break;
|
3235
|
+
case T_IndexElem:
|
3236
|
+
retval = _copyIndexElem(from);
|
3237
|
+
break;
|
3238
|
+
case T_ColumnDef:
|
3239
|
+
retval = _copyColumnDef(from);
|
3240
|
+
break;
|
3241
|
+
case T_Constraint:
|
3242
|
+
retval = _copyConstraint(from);
|
3243
|
+
break;
|
3244
|
+
case T_DefElem:
|
3245
|
+
retval = _copyDefElem(from);
|
3246
|
+
break;
|
3247
|
+
case T_LockingClause:
|
3248
|
+
retval = _copyLockingClause(from);
|
3249
|
+
break;
|
3250
|
+
case T_RangeTblEntry:
|
3251
|
+
retval = _copyRangeTblEntry(from);
|
3252
|
+
break;
|
3253
|
+
case T_SortGroupClause:
|
3254
|
+
retval = _copySortGroupClause(from);
|
3255
|
+
break;
|
3256
|
+
case T_WindowClause:
|
3257
|
+
retval = _copyWindowClause(from);
|
3258
|
+
break;
|
3259
|
+
case T_RowMarkClause:
|
3260
|
+
retval = _copyRowMarkClause(from);
|
3261
|
+
break;
|
3262
|
+
case T_WithClause:
|
3263
|
+
retval = _copyWithClause(from);
|
3264
|
+
break;
|
3265
|
+
case T_CommonTableExpr:
|
3266
|
+
retval = _copyCommonTableExpr(from);
|
3267
|
+
break;
|
3268
|
+
case T_PrivGrantee:
|
3269
|
+
retval = _copyPrivGrantee(from);
|
3270
|
+
break;
|
3271
|
+
case T_FuncWithArgs:
|
3272
|
+
retval = _copyFuncWithArgs(from);
|
3273
|
+
break;
|
3274
|
+
case T_AccessPriv:
|
3275
|
+
retval = _copyAccessPriv(from);
|
3276
|
+
break;
|
3277
|
+
case T_XmlSerialize:
|
3278
|
+
retval = _copyXmlSerialize(from);
|
3279
|
+
break;
|
3280
|
+
|
3281
|
+
default:
|
3282
|
+
pool_error("unrecognized node type: %d", (int) nodeTag(from));
|
3283
|
+
retval = from; /* keep compiler quiet */
|
3284
|
+
break;
|
3285
|
+
}
|
3286
|
+
|
3287
|
+
return retval;
|
3288
|
+
}
|
3289
|
+
|
3290
|
+
/* from backend/nodes/bitmapset.c start */
|
3291
|
+
#define BITMAPSET_SIZE(nwords) \
|
3292
|
+
(offsetof(Bitmapset, words) + (nwords) * sizeof(bitmapword))
|
3293
|
+
|
3294
|
+
/*
|
3295
|
+
* bms_copy - make a palloc'd copy of a bitmapset
|
3296
|
+
*/
|
3297
|
+
Bitmapset *
|
3298
|
+
bms_copy(const Bitmapset *a)
|
3299
|
+
{
|
3300
|
+
Bitmapset *result;
|
3301
|
+
size_t size;
|
3302
|
+
|
3303
|
+
if (a == NULL)
|
3304
|
+
return NULL;
|
3305
|
+
size = BITMAPSET_SIZE(a->nwords);
|
3306
|
+
result = (Bitmapset *) palloc(size);
|
3307
|
+
memcpy(result, a, size);
|
3308
|
+
return result;
|
3309
|
+
}
|
3310
|
+
/* from backend/nodes/bitmapset.c end */
|